Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I teleport all the players to an area?

I need to teleport all players to an area but I can't seem to find a way,here is a script I found on YouTube but it only messes up the player's avatar.

local position = {-4,3,209} -- This is a part I changed and added {} because it has a blue line underneath it
local players = game.Players:GetChildren()
for i = 1, #players do
	players[i].Character:MoveTo(Vector3.new(position))
end

1 comment

0

Try to use Character.HuamnoidRootPart.Vector3 = Vector3.new(position) on line 4

2 answers

✓ Accepted answer

The position Value needs to be a Vector3 not a table/list i would change that to:

local position = Vector3.new(-4,3,209)
local players = game.Players:GetChildren()
for i = 1, #players do
    players[i].Character:MoveTo(position) --// this doesn't need to re-cast back to a Vector3 again as its already a Vector3
end

Hope this helps!

TGazza's answer is incorrect. To teleport players, you play with the CFrame property of their respective HumanoidRootParts. MoveTo is a method that makes the player walk to an absolute point in world, that's why it doesn't work. I recommend you to also determine a spacing variable, so the players won't teleport inside each other.

Please, accept this answer in case it's useful for you :)

1 comment

0

pretty sure theres a MoveTo for humanoids wich makes the player walk to a place and theres a MoveTo for models which just teleports them to a location

This discussion is preserved as it was. New answers, comments, and votes are closed.