How would you teleport all players to another game if someone clicks a button

Hello! I was wondering if I could teleport all the players in the server to another game if one person clicks a button?

1 Like

(if its a click detector)

script.Parent.MouseClick:Connect(function()
for i,playerT in pairs(game:GetPlayers()) do
--teleport playerT
end
end)
1 Like

Add a click detector to the block and do as the script given by this dev

Make sure both the game have the 3rd party teleportation on
U can do so by going into GAME SETTINGS in studio and enabling the option under permissions

I hope it helps :slight_smile:

2 Likes

Thanks but how would I teleport them to another place? Would I just do TeleportService:Teleport(placeID_1, player)

local tpservice = game:GetService("TeleportService")

script.Parent.MouseClick:Connect(function()
for i,playerT in pairs(game:GetPlayers()) do
tpservice:Teleport(placeID,playerT)
end
end)

Thank so much but I get an error that says

GetPlayers is not a valid member of DataModel1 “game”

small mistake

local tpservice = game:GetService("TeleportService")

script.Parent.MouseClick:Connect(function()
for i,playerT in pairs(game.Players:GetPlayers()) do
tpservice:Teleport(placeID,playerT)
end
end)

OMG! Thank you so so much for helping me :slight_smile: I have been trying to do this for ages!