PrivateServerId equals empty string on reserved server

I was trying to pass the amount of players from teleportPartyAsync() via teleportOptions:SetTeleportData() but none of the methods to get that data worked correctly for me. So I decided to use MemoryStoreService to store the amount of players in a sorted map, with the key being the reserved server’s privateServerId.

Summary (Starting place, server)

local MemoryStoreService = game:GetService("MemoryStoreService")
local playerCount = MemoryStoreService:GetSortedMap("PlayerCount")
local TELEPORT_OPTIONS = Instance.new("TeleportOptions")

TELEPORT_OPTIONS.ShouldReserveServer = true

local privateId , AccessCode = TeleportService:TeleportPartyAsync(14043699970 , Match.Players , TELEPORT_OPTIONS )
		playerCount:SetAsync(privateId , count , 10800)

Summary (Destination place, server)

local MemoryStoreService = game:GetService("MemoryStoreService")
local PlayerCount = MemoryStoreService:GetSortedMap("PlayerCount")

game.Players.PlayerAdded:Connect(function(player : Player)
	print(game.PrivateServerId)
	local maxPlayers = PlayerCount:GetAsync(tostring(game.PrivateServerId) ) -- This line returns an error because game.PrivateServerId = ""
	print(maxPlayers)
end)

Why does this happen?

1 Like

I’m pretty sure PrivateServerIDs only work when a Player creates a private server inside of your game. Reserving a server is when you want to Create a specific TEMPORARY Private server inside the game. These servers are usually temporary, which is why they aren’t giving a private server ID.

Instead, you can probably try this:

local ServerID = game.JobId

This will give you this servers Specific Server ID.

But then how do I get that value from the starting place?
If I understand correctly this only works in the destination place.

Furthermore, wouldn’t that mean that the documentation is just flat out wrong?

Have you tested In-Game if the private/reserved server is actually working?

Yes, I am not testing in studio because teleports do not work there.

Hmmm… Apologies for the long reply time.

I think this might be an issue with Roblox Itself. If a function that roblox instructs you to use isn’t working as intended, you can possibly try reporting it as a bug, or looking for any backup features.

I can try re-creating your situation, and figuring out the problem. (Which I will do soon.)

1 Like

Don’t worry, it turns out that my mistake was thinking that the teleportData field for the function could also take a TeleportOptions instance as an argument, hence why no privateserverID was being added. I ended up using a different function that also allows you to teleport a group of players and use teleportOptions.

1 Like

Which function would that be? Please be specific and mark replies so others with similar issues can resolve them. Thanks!