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

Is it possible to teleport all the players in one server?

Asked by
valchip 789 Moderation Voter
5 years ago
Edited 5 years ago

Lets suppose we are at Place1 and then we teleport all the player at Place2. Now, is there a way to teleport all the players in 1 server, like ALL of them?

2 answers

Log in to vote
4
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
5 years ago

You can use TeleportService:TeleportPartyAsync() to teleport multiple players at once to an other place, by passing the table of players as the second argument, rather than just a single one.

game:GetService("TeleportService"):TeleportPartyAsync(1818, game:GetService("Players"):GetPlayers())

Keep in mind that place must be a part of the current game.

If you want to teleport all players to a place which isn't a part of your game, you should probably iterate all players and use TeleportService:Teleport() on them separately.

for i,v in pairs(game:GetService("Players"):GetPlayers()) do
    game:GetService("TeleportService"):Teleport(1818, v)
end
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Yes, there is a way to do it using TeleportToPrivateServer and ReserveServer functions of TeleportService.

I'm not sure if that's really what you need but try it, I think it will be good for what you need since TeleportToPrivate server takes an array of players to teleport.

Links: TeleportToPrivateServer ReserveServer

Answer this question