I have been having this issue for weeks and I have no clue how to solve it. Basically the script skips over a particular for loop for no reason whatsoever and from testing with printing, it skips the whole of the for loop and only the for loop. The rest of the script is my take on a script that checks how far the player is from the AI and if it close enough, locks onto it. I know it’s dubious but I like learning scripting authentically and developing my own scripting style so unless the rest of the script directly causes the issue, just ignore the bad code for now(full code in file)
Yes more times than u can count… I have printed it and there is always at least one player, which is me, yet it still does not run. and plus, it never actually gets to the in pairs loop, because everything in the for loop(that the in pairs loop is in) gets skipped
I’m guessing the “skip” appears because the script starts running before any of the players join the game.
Try removing the playtable variable at the start and instead, make the loop line be for i, v in pairs(game.Players:GetPlayers()) do as it always gets the current player list, rather than the old player list at the start of the script.