Game can’t see the “var soldier = soldiers[i]” from this function;
You can’t acces variables from functions in your while true loop. You have to redefine soldier.
Yeah, i move them inside the while-true and it works. Thank you.