Can't get TeleportAsyncResult.PrivateServerId when teleporting to a ReservedServer

I’m teleporting a player and trying to get access to TeleportAsyncResult.PrivateServerId, which prints nil. Printing TeleportAsyncResult.ReservedServerAccessCode works fine. The player gets teleported properly. The docs say I should be able to access that when teleporting to a reserved server.

local Options = Instance.new("TeleportOptions")
Options.ReservedServerAccessCode = Key
local Return = game:GetService("TeleportService"):TeleportAsync(PlaceId, {Player}, Options)
print(Return.ReservedServerAccessCode) -- prints the correct code
print(Return.PrivateServerId) -- prints nil

2 Likes

Have you tried printing game.PrivateServerId once you’re fully teleported? If it returns an empty string then something’s wrong.

image
It does print on the new server.

You can use ReserveServer to get the PrivateServerId along with the ReservedServerAccessCode before teleporting the players to the target server.

local TeleportService = game:GetService("TeleportService")
local RSAccessCode, PrivateServerId = TeleportService:ReserveServer(placeId)
1 Like

This works for my usecase, thanks!
But it seems like you can’t get the PrivateServerId when you use a set AccessCode.
I have opened a bug report for that.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.