We use cookies on this site to enhance your user experience
Collapse Sidebar


This function returns an access code that can be used to teleport players to a reserved server, along with the DataModel/PrivateServerId for it.

ReserveServer can only be called on the server.

Reserved Servers

The following are characteristics of reserved servers:

  • They can only be accessed using TeleportService/TeleportToPrivateServer, with the access code ReserveServer returns
  • A game server is started when the access code is first used
  • No more than one game server instance can exist at any time for each access code
  • Access codes remain valid indefinitely, meaning reserved servers can still be joined if no game server is running (in this case a new game server will be started)

You can see if the current server is a reserved server by using the following code:

local isReserved = game.PrivateServerId ~= "" and game.PrivateServerOwnerId == 0

The DataModel/PrivateServerId is constant across all server instances associated with the server access code, the DataModel/JobId is not.


Name Type Default Description

The DataModel/PlaceId of the place the reserved server is being created for


Return Type Summary

The server access code required by TeleportService/TeleportToPrivateServer and the DataModel/PrivateServerId for the reserved server

Code Samples

TeleportService: Teleport to a Reserved Server

The following code would send everyone in the current game to a reserved server. Since reserved servers can only be joined by using /TeleportService/TeleportToPrivateServer, nobody will join the reserved server afterwards.

Mind that, since everyone will be teleported, the current server will (probably) shutdown as nobody would be left in it.

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

TeleportService: Teleport to a Reserved Server via Chat

The following code would reserve one server, if it hasn’t be reserved before. Whenever someone says “reserved” he/she will be teleported to the private server.

local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")
local DSS = game:GetService("DataStoreService")
local DS = DSS:GetGlobalDataStore()
-- Get the saved code
local code = DS:GetAsync("ReservedServer")
if type(code) ~= "string" then -- None saved, create one
	code = TS:ReserveServer(game.PlaceId)
local function Joined(plr)
	-- Everytime they chat, we want to know
		if msg == "reserved" then -- Aha, that's our cue
-- Connect all current and future players
for k,v in pairs(Players:GetPlayers()) do