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

How does ReserveServer and TeleportToPrivateServer work?

Asked by 4 years ago

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

Log in to vote
0
Answered by
moo1210 587 Moderation Voter
4 years ago

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!

Ad

Answer this question