Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I teleport all the players to an area?

Asked by 3 years ago

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
0
Try to use Character.HuamnoidRootPart.Vector3 = Vector3.new(position) on line 4 RazzyPlayz 497 — 3y

2 answers

Log in to vote
0
Answered by
TGazza 1336 Moderation Voter
3 years ago

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!

Ad
Log in to vote
0
Answered by
nievadev 112
3 years ago
Edited 3 years ago

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 :)

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 testing34545 12 — 3y

Answer this question