This is a pretty hard question to ask because I can't possibly fit everything into a question but I can explain the problem. My game logic/game script is essentially:
function game()
-- stuff
end
while true do
while players < 2 do
-- tell player to invite more players and all that jazz
end
if players >= 2 then
game()
end
end
(this is just pseudocode, I'm ignoring things like wait() and Roblox API for simplicity because the idea is still the same)
Now, in my 'game' function, when players are ready ( i.e aren't in a menu etc.) it will teleport all the ready players to a point where the game is. Unfortunately, since 'game()' is run all the time, the players keep getting teleported over and over and it doesn't stop. I'm not sure how to make is so that it only ever teleports them once even if 'game()' is constantly run.
Here is the real code for the teleportation explained the best I can:
if #ready >= 2 then -- if the players in the list 'ready' (the players that are ready for the game to start) is less big than or equal to 2
print(player.Name .. " moved") -- show which player is moved
player.Character:MoveTo(game.Workspace.LevelGeometry.Model.start.Position - Vector3.new(-10,0,9*offset)) -- actually move the player
end
The code is being looped through all the 'ready' players, and 'game()' is being looped all the time so this means all my players keep getting teleported constantly when I only want them to get teleported once. And honestly, I don't really like having my game script like this but I can't really think of better and more effective methods so if you know other ways to do this it would help! I hope this is understandable ._.

2 comments
Make a conditional statement to keep track of when the players have loaded. When the players are loaded simply use "break" on the loop to stop the loop and move on to the next block of code.
Like a boolValue in the player or?