New API lua:remote_event:: TeleportService.TeleportInitFailed

Hi everyone!
We shipped a new remote event “TeleportService.TeleportInitFailed” and Enum “TeleportResult” today, then we can programmatically handle teleport errors from server script and client script.

lua:remote_event:: TeleportService.TeleportInitFailed

RBXScriptSignal TeleportInitFailed(
	Player player,
	TeleportResult result,
    String errorMessage  )

Parammeters:

	Player
        Type: player
	Result
		Type: TeleportResult 
	errorMessage
		Type: String

Description: Fire when Teleport failed and the players didn’t leave the current game server. Fire on the server and client. It is to handle cases where players never leave the current game server due to a failed teleport.

lua:enum:: TeleportResult

Used to determine teleport result and the reason for teleport failed.

Enums

Name Value Description
Success 0 Success
Failure 1 Unknown exception
GameNotFound 2 Cannot find game server
GameEnded 3 This game has ended
GameFull 4 Requested game is full
Unauthorized 5 Not authorized to join this game
Flooded 6 Server is busy
IsTeleporting 7 The previous teleport is in processing

Referenced by

TeleportService.TeleportInitFailed(Player player, TeleportResult result, String errorMessage)

Example

local TS = game:GetService('TeleportService')
TS.TeleportInitFailed:connect(function(player, resultEnum, msg)
		local fmt = string.format('server: eleport %s failed, resultEnum:%s, msg:%s',player.Name, tostring(resultEnum), msg)
 		print(fmt)
end)
40 Likes

And with this I reconsider working on my matchmaker for my MOBA/ARTS game :thinking:

Nice work guys. Perhaps we will see some life pumped back into scrapped
TeleportService games!!

6 Likes

thank you my guy

teleportservice is a wonderful gift from our benefactors

Does the event also fire on success? Why isn’t there just a .TeleportInitFinished for every possible enum result?

I saw this in the release notes and I was overjoyed! Thank you!

TeleportInitFailed won’t fire on success


sorry if this is bad of me to do but I feel I had to

3 Likes

thank you for correction.

2 Likes

If it won’t fire on success, why does Enum.TeleportResult.Success exist?

Define the every possible for the enum “TeleportResult”. Just reserve the number “0” to “Success”.

1 Like

What’s the reasoning behind the “Init” in TeleportInitFailed? Is there another API coming that is “TeleportFailed”? Init seems a little redundant and seems to just add clutter to the name, but maybe I’m missing something.

I guess if a player is already “in transit” (connecting to/loading the new place) the matchmaker is no longer involved and thus can’t report anything to the origin game server. So the “Init” refers specifically to the matchmaking phase.

1 Like

Good question! Thank you. It is to handle cases where players never leave the current game server due to a failed teleport.

you’re right

Great update! This’ll help me out a lot with my current projects.

(Just a small thing)
:connect is deprecated in favor of :Connect.

Its a small thing, but it’d bother me for the next 10 minutes if I didnt say anything…

1 Like

Any plans for functionality to deliberately cancel a teleport request? In my game, users can specify a gamemode they want to play (which will use the teleport service). If one gamemode takes too long to connect, I’d like the user to be able to cancel and be able to play a different gamemode (instead of awkwardly waiting for the first one to finish).

1 Like