Best way to move a large number of players to a position at the same time?

I am making a round based game and once the game starts all the players should teleport to a specific location however for some reason when I test it, with a couple of players only like 2 players actually get teleported while the rest just don’t for some reason.

for _, Plr in next, plrs do
				wait()
				Plr.Character.HumanoidRootPart.CFrame = TelePart.CFrame
			end

This is what I have so far, obviously plrs is a table of all the players in the server and this table is made 10 seconds after every player has joined the server. I don’t really know why this happens because it seems very simple and I also get no errors.

1 Like
local Players = game:GetService('Players')
local TelePart = workspace['TelePart'] -- Or the name of it!

for _, Plr in ipairs(Players:GetPlayers()) do
    Plr.Character.HumanoidRootPart.CFrame = TelePart.CFrame
end

wait()

That’s probably the best method you can use! :smile:

5 Likes

just out of curiosity what is different with what you did, and what i had.

The wait is yielding (I believe) 0.05 seconds per player being looped, which will slow your game down by 0.05 * NumberOfPlayers. Now if players are joining after the loop has completed, it won’t teleport them; You’ll need to add a wait to assure all players have loaded in before teleporting them.

ipairs runs microscopically faster. I was skeptical about this at first myself but then I tested it and it’s true.