I need this to teleport others to this location but its not working. I also need it so that it will teleport after 30 seconds and repeat this continuously.
game.Players.Character:MoveTo(Vector3.new(123, 0.59, -34))
I need this to teleport others to this location but its not working. I also need it so that it will teleport after 30 seconds and repeat this continuously.
game.Players.Character:MoveTo(Vector3.new(123, 0.59, -34))
My best guess as to teleporting all the players to that location would be to use a generic for loop. Generic fors go through all values in a table. So basically we need to get all the children in Players, get their characters and move them to that location. So it would look like this...
wait() --You can remove this if you want, but it's better if it's there
for i,v in pairs(game.Players:GetChildren()) do
v.Character:MoveTo(Vector3.new(123, 0.59, -34))
end
And if you wanted to do that every 30 seconds, you would use a while loop, like this:
while true do --Makes an infinite loop
wait()
for i,v in pairs(game.Players:GetChildren()) do
v.Character:MoveTo(Vector3.new(123, 0.59, -34))
end
wait(30)
end
Hope this helped.
"Players"
e = game.Players:GetChildren()
t = e.Character
--First of all you need to define "players" If you want 1 player or all players, I won't gaurantee this will work
game.Players.PlayerAdded:connect(function()
if t ~= nil then then
for i = 1, #e do
t:MoveTo(Vector3.new(123,0.59,34))
elseif t == nil then
return
end
end
end)
easy.
function teleport(player,position)
if player.Character:FindFirstChild("Torso") then
player.Character.Torso.CFrame = CFrame.new(position) -- assuming the position is Vector3
end
end
function teleportAll(people,position)
for i,v in pairs(people) do
teleport(v,position) -- possibly a randomized position, or it would cause alot of people in one spot.
end
end
while wait() do
wait(30) -- intermission
teleportAll(game.Players:GetChildren(),Vector3.new(0,10,0))
wait(3) -- choose random player
local peeps = game.Players:GetChildren()
teleport(peeps[math.random(1,#peeps)],Vector3.new(0,10,20))
end
This is all relatively easy scripting. I prefer using torso.CFrame than MoveTo() because with CFrame you can be precise.
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
This might work on a lot of players, if you just want 1 to teleport. Remove the s from Players?
Does not work
mmk
I edited it, try that one , By the way it won't loop, just begin when a player is added.