I’ve tried looking around but I still don’t know why this doesn’t work.
Here’s what’s in the main place
local ReserveCode = TeleportService:ReserveServer(subplaceId)
-- Store the code in their TeleportData so the subplace can read it
local teleportOptions = Instance.new("TeleportOptions")
teleportOptions:SetTeleportData({PrivateCode = ReserveCode})
TeleportService:TeleportAsync(subplaceId,{player},teleportOptions)
And here’s what’s in the sub place
game.Players.PlayerAdded:Connect(function(Player)
Player:LoadCharacter()
local joinData = Player:GetJoinData()
while not joinData.TeleportData do task.wait(0.1) print("Loading data") end
while not joinData.TeleportData[1] do task.wait(0.1) print("Loading code") end
if joinData and joinData.TeleportData and joinData.TeleportData[1] then
local reservedCode = joinData.TeleportData[1]
print("Player joined with reserved code:", reservedCode)
Player.PlayerGui:WaitForChild("Menu").MainFrame.JoinCode.Text = "Your join code is: ".. reservedCode
end
end)