If a ReservedServerAccessCode is nil, and set in a TeleportOptions object, players teleported will be placed in a broken server. After teleport, players won’t see any instances in workspace. Within a few seconds they’ll be kicked for one of three reasons:
Roblox has shut down this server for maintenance
Client initiated disconnect
Player data nil, player kicked (this is unique to experiences using ProfileService)
Steps to Reproduce:
Create a TeleportOptions instance
Set the ReservedServerAccessCode to nil
Teleport players using TeleportAsync API
Expected behavior
I would expect an error to be thrown that can be caught in a Pcall or Promise.
Looks like I left out some important details on this. Here’s the code that was calling TeleportAsync.
local success, teleportOptions = pcall(function()
return Create "TeleportOptions" {
ReservedServerAccessCode =
if (runContext == Enums.ServerRunContext.WorldPlay) then
reservedServers.WorldPlayAccessCode
else
reservedServers.WorldEditAccessCode
}
end)
-- If something went wrong, bail
if (not success) then
return {
Error = teleportOptions
}
end
TeleportService:TeleportAsync(game.PlaceId, {player}, teleportOptions)
What failed in my experience
The Create keyword is a wrapper for Instance.new(). After some investigation, here’s what I figured out. The Create library does some fancy error handling and default value setting. So, the inline if statement evaluated to nil, which Create caught, and set as a blank string. Meaning, we have a not-null TeleportOptions with a ReservedServerAccessCode of “”.
Steps to Reproduce
I was able to reproduce this by using your code, and assigned ReservedServerAccessCode to ""
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
game.Players.PlayerAdded:Connect(function(player)
print("someone joined")
wait(3)
--= create teleport options with nil reserve server
local teleportOptions = Instance.new("TeleportOptions")
-- set this to a blank string
teleportOptions.ReservedServerAccessCode = ""
TeleportService:TeleportAsync(game.PlaceId, {player}, teleportOptions)
end)
Going back to this - we believe this error should be gone now, we have added a check on our end too to check empty string as well. Feel free to post if the issue happens again!