I'm trying to make a script that teleports people to a certain co-ordinate, but every time I load the game it continuously teleports players to the exact same location. Please could someone help me?

players = game.Players:GetChildren()
	repeat wait() until game.Players.NumPlayers > 1
	for teleporting = 1, #players do
		wait()
		toMove = players[teleporting].Character.Torso
		toMove.CFrame = CFrame.new(math.random(5,20), 75,math.random(165,175))
	end

4 comments

0

What is your exact intentions with this? Teleport every player once? I can't help you fix this if I don't know what it's supposed to be doing in the first place.

0

The code is meant to teleport every player at once to a specified co-ordinate.

0

What is the event that triggers this?

0

Use randomseed and a little wait to have different results. Also improve the code a little(Use GetPlayers(), not GetChildren()- use in pairs for this, #players - get rid of the useless wait() nothing - You're missing an end