TeleportInitFailed fires on both the client and server when a request to teleport from a function such as
TeleportService/Teleport fails and causes the player to not leave the current place server. The
enum/TeleportResult provided by this event describes the reason the teleport failed, along with the error message displayed to the player.
Sometimes a teleportation can fail after the
Player has left the place due to Roblox server issues. This event does not fire in this case, and the player would be disconnected. They would need to rejoin the game.
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)