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
local code = game:GetService("TeleportService"):ReserveServer(4288429706)
game:GetService("TeleportService"):TeleportToPrivateServer(4288429706,code,game.Players:GetPlayers())
local code = game:GetService("TeleportService"):ReserveServer(game.PlaceId)
game:GetService("TeleportService"):TeleportToPrivateServer(game.PlaceId,code,game.Players:GetPlayers())
ReserveServer returns a tuple with the first value being the access code. You need to make sure you’re only passing the code.
local code = table.pack(game:GetService("TeleportService"):ReserveServer(4288429706))[1]
game:GetService("TeleportService"):TeleportToPrivateServer(4288429706,code,game.Players:GetPlayers())
The table.pack isn’t necessary, since the extra values of the tuple are discarded due to having no variables to be assigned towards. Including only a single variable is sufficient enough.
In addition to this, even if both values of the tuple were passed to TeleportService, the subsequent arguments passed in there force the tuple size to 1, thus only getting the access code and discarding the ServerId.
Yeah, my mistake. Thanks for pointing it out, my brain wanted to think variables can hold more than 1 value because I wasn’t sure what else could be wrong with the code OP provided haha