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

How does ReserveServer and TeleportToPrivateServer work?

I want to make a game with matchmaking. So I thought I will need ReserveServer and TeleportToPrivateServer. However, I have no idea how it works. Can someone explain it for me with some code if possible

1 answer

✓ Accepted answer

Reserving servers:


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

Here is a edited example from the roblox wiki, basicly you reserve the server with local code = ReserveServer(game.PlaceId) That returns a code so you should teleport with TeleportToPrivateServer(game.PlaceId,code,game.Players.username (and replace username with the players username of course). So overall when you reserve a server it returns a code that you teleport to it via teleporttoprivateserver. If this solved your question be sure to mark this answer with the checkmark!

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