Game can’t see the “var soldier = soldiers[i]” from this function;
You can’t access 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.