This event fires if a request to teleport (from a function such as
TeleportService/Teleport) fails and the player does not leave the current place server.
It is fired on both the client and the server.
It includes a teleportResult argument (a
Enum/TeleportResult enum) describing the reason the teleport failed along with the error message that is displayed to the user.
It is possible for teleportation to fail after the
Player has left the place due to Roblox server issues. This event will not fire in this case and the user will be disconnected and required to rejoin.
Enum/TeleportResult indicates the state of the teleport which can be one of several enum values:
|1||Teleport failed because the destination server was full|
This service does not work during playtesting in Roblox Studio — To test aspects of your game using it, you must publish the game and play it in the Roblox application.
The error message indicating why the teleport failed
Reattempt Failed Teleport
This code sample includes a function that will reattempt a teleport if Roblox servers are busy or an unexpected failure has occurred. It should be ran on the client.
local TeleportService = game:GetService("TeleportService") local Players = game:GetService("Players") local localPlayer = Players.LocalPlayer local function localTeleportWithRetry(placeId, retryTime) local connection connection = TeleportService.TeleportInitFailed:Connect(function(player, teleportResult, errorMessage) if player == localPlayer then print("Teleport failed, TeleportResult: "..teleportResult.Name) -- check the teleportResult to ensure it is appropriate to retry if teleportResult == Enum.TeleportResult.Failiure or teleportResult == Enum.TeleportResult.Flooded then -- disconnect the connection connection:Disconnect() -- retry in retryTime seconds delay(retryTime, function() print("Reattempting teleport") TeleportService:Teleport(placeId) end) end end end) TeleportService:Teleport(placeId) end -- usage example: local placeId = 1818 -- Crossroads localTeleportWithRetry(placeId, 5)