Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to I keep players from being sent to a server with other players?

I'm making a game that requires a player/group of players to get teleported to another place inside the game. How do I make sure 2 groups of players don't get teleported to the same server? I'm completely lost and have no clue what to do. Anything would help! Thanks in advance, Tim

1 answer

✓ Accepted answer

You could use TeleportToPrivateServer.

More information: https://developer.roblox.com/en-us/api-reference/function/TeleportService/TeleportToPrivateServer

Example:

local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")
 
local code = TS:ReserveServer(game.PlaceId) -- Returns a code
local players = Players:GetPlayers() -- Get a list of all players
 
TS:TeleportToPrivateServer(game.PlaceId,code,players) -- Actually teleport the players
-- You could add extra arguments to this function: spawnName, teleportData and customLoadingScreen

This discussion is preserved as it was. New answers, comments, and votes are closed.