Why are you looping through nothing? Right now if the target is fainted and is in the source position, it will just infinitely loop and freeze the process, and in any other situation, it doesn't loop at all.