Reproduction Steps
Place the following code in a server script somewhere it will run like in ServerScriptService:
local teleportService = game:GetService("TeleportService")
teleportService.TeleportInitFailed:Connect(function(failedPlayer, teleResultItem, errMsg, placeId, teleOptions)
print("TeleportInitFailed!", errMsg, teleResultItem)
end)
wait(5)
local player = game.Players:GetPlayers()[1]
local success, msg = pcall(function() return teleportService:TeleportAsync(233195390, {player}) end)
warn("success:", success, " message (if any):", msg)
Then, playtest in Roblox Studio.
Wait 5 seconds and observe the output.
Expected Behavior
The orange warning in the output should say something along the lines of
success: false message (if any): TeleportService:TeleportPartyAsync error: The player[17967658] with wrong session.
like it does with TeleportPartyAsync.
Actual Behavior
The following warning is posted to the output:
success: true message (if any): Instance
The pcall
does not see any error and believes the player has successfully teleported so my code cannot handle this.
This makes testing code that is meant to handle real-world teleport errors difficult as this is normally the most reliable way to do so.
I understand that right after this a red error appears saying exception while signaling: Cannot Teleport in the Roblox Studio.
but this is a lie as it does not actually throw an exception. There is no error for my code to detect. Note that not even TeleportInitFailed fired. There is no way for me to detect that something has gone wrong in-code.
I understand that this won’t have any real-world impact as no users are playing in Roblox Studio, but this does interfere with the development process and should be a simple fix to make testing teleport error handling easier for devs.
Workaround
Use TeleportPartyAsync when testing instead.
Issue Area: Studio
Issue Type: Other
Impact: Low
Frequency: Constantly