How to teleport after a certain amount of time?

How would you teleport all the players to another game after a certain time for example 30 seconds? This is what I have tried

wait(30)
local tpservice = game:GetService(“TeleportService”)

for i,playerT in pairs(game.Players:GetPlayers()) do
	tpservice:Teleport(6024797420,playerT)
end

end)

1 Like

Well what is the problem here? You already added a wait 30 seconds and then execute teleportation for all players…

1 Like

Agreed with the post above, have no idea what you mean.

1 Like

Not sure what this end) is for though, is it inside a function?

2 Likes

most likely. If it’s not, then that’s the reason it errors.

2 Likes

Sorry didn’t mean to put it there. It still doesn’t work when I remove it.

wait(30)

for i,v in pairs(game.Players:GetPlayers()) do
       game:GetService("TeleportService"):Teleport(6024797420,v)
end

2 Likes

Does it say any errors as in Invalid place ID or maybe you did not enable 3rd party teleport in the game settings

also just a little optimization, you can put the service and place id as a local variable first so when the 30 seconds time is up, the script will declare these variables easily thus reducing a bit of script activity

local tpservice = game:GetService("TeleportService")
local PlaceIdtoteleportto = 6024797420
wait(30)
for i,players in pairs(game.Players:GetPlayers()) do
tpservice:Teleport(PlaceIdtoteleportto,players)
end



1 Like

I have 3rd party teleport enabled

Put the code in serverscriptservice the one i sent u

1 Like

I will try this now. Thanks for your help everyone

Your testing this in game right? You can’t teleport in studio.

1 Like

Thank you! Your script worked! Thanks to everyone else who helped as well :slight_smile:

2 Likes