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

How do you make a timed teleport?

Asked by 10 years ago

Is there a script which can automatically teleport players from the lobby to a map and from the map back to the lobby but like, every 5 minutes or so.

0
Try not to ask questions like "is there a script that...", because the answer is almost always "yes". The trick is to try solving the problem yourself then asking for feedback. Ozzypig 185 — 10y

2 answers

Log in to vote
0
Answered by 10 years ago

Yes. Here is a quick one.

time = 60 * 5 -- 5 Mins
players = game.Players:GetChildren()
while true do
for i = 1, #players do
    wait(time) 
    players[i].Character:MoveTo(Vector3.new(pos1,pos2,pos3))
    wait(time)
    players[i].Character:MoveTo(Vector3.new(pos1,pos2,pos3))

end
end

Ad
Log in to vote
0
Answered by 10 years ago
local Time = 60 * 5  -- 5 Minutes
local LobbyCFrame = CFrame.new(0, 0, 0)
local MapCFrame = CFrame.new(0, 0, 0)
local InLobby = true

while wait() do
wait(Time)
if InLobby == true then
for i,v in pairs (game.Players:GetPlayers()) do
if v.Character:FindFirstChild("Torso") then
v.Character.Torso.CFrame = MapCFrame 
end
end
wait(Time)
InLobby = false
elseif InLobby == false then
for i,v in pairs (game.Players:GetPlayers()) do
if v.Character:FindFirstChild("Torso") then
v.Character.Torso.CFrame = LobbyCFrame 
end
end
wait(Time)
InLobby = true
end
end

Answer this question