Meaningful Messages from TeleportToPlaceInstance()

Could the Messages returned by TeleportToPlaceInstance be more meaningful?

For example if I try to teleport to a Server that is Full I get the message. . .

I would rather it display a more meaningful message such as, “Teleport failed. The server is full.”

I’m only bringing this up because, from the comments on my game, people think my lobby is broken.

Is that from your hockey game with the universe-server system thingy?

Yes

While I agree that the returned message should return something correct and descriptive, don’t you already handle the “servers” (universe places) through the DataStore? What’s keeping you from tracking the server population yourself and displaying your own “Server is full” message? IMO letting someone through to that ugly ROBLOX message that isn’t even made to be pretty is a bad idea, so I’d always want to display the result to the user in a much more aesthetically appealing manner, if possible.

Oh I do, you can see from this image. . .

However, the data in the DataStore doesn’t updating immediately:

  1. It takes time for the Lobby to receive the info from a server to update it’s PlayerList.
  2. I don’t have it update immediately when ever someone joins or leaves the server (too many joins in a short time creates a huge lag spike if I did), instead I have it update every 30 seconds or 60 seconds, can’t remember.
  3. Also I have a cache system set up for the lobby since it uses a lot of datastore request, which won’t update the cache until 2 mins have passed of last being updated with DataStore Data.

So there still is that chance a player could get into a server that the DataStore is telling him/her it is full, since it really isn’t full.

Accessing the DataStore shouldn’t create a lag spike of any sort. Is that just something you assumed or something that actually happened? If it’s the latter, you should post a repro for it in bug reports. You’ll never run out of datastore requests because you get two requests each time someone joins the game.

I’m saying I don’t use UpdateAsync when a Player Joins/Leaves a Server, since I don’t want 10 UpdateAsync’s being called on the same key when 10 people join a server in under 5 seconds, that will cause a Lag Spike, from experience. So instead I use UpdateAsync every 30-60 seconds to update the PlayerList Data.

And the 3rd bullet point is only there cause there is gonna be that guy who is just spamming the Refresh button.

Well the teleport messages were removed, but were not replaced with anything, now it’s even more confusing when the game doesn’t teleport you, and you get no notification that it failed or even attempted to teleport the player.

Here is a gif of not being able to join due to the server being full:
https://i.gyazo.com/fa60ddea75b03eb3ec28d44d905d3e7e.gif

Here is one where the teleporting works:
https://i.gyazo.com/027c57bc785780a45ff5fa1e26cb007e.gif

in both cases, nothing is shown.

here is a confused customer:


My suggestion wasn’t to remove the messages, it was just to make them more informative.

Rather, it would make much more sense for Teleport methods to return an enum for the status of the request. That way developers can handle the request however they see fit or create notices which match their UI.

4 Likes

I agree. I wish errors from services on ROBLOX were all handled like this. It’s so hard to do proper error handling when all you get is a string error message.

3 Likes

Here is the code that created the teleport messages in the CoreScript notifications script before the messages were removed. If you want the messages back you can use this code.

local TeleportMessage = nil
local function sendTeleportNotification(msg, time)
	if TeleportMessage then
		TeleportMessage:Destroy()
	end
	local playerGui = LocalPlayer:FindFirstChild('PlayerGui')
	if playerGui then
		TeleportMessage = Instance.new('Message')
		TeleportMessage.Text = msg
		TeleportMessage.Parent = playerGui
		--
		if time > 0 then
			delay(time, function()
				TeleportMessage:Destroy()
			end)
		end
	end
end

local function onTeleport(state, placeId, spawnName)
	if state == Enum.TeleportState.Started then
		sendTeleportNotification("Teleport Started...", 0)
	elseif state == Enum.TeleportState.WaitingForServer then
		sendTeleportNotification("Requesting Server...", 0)
	elseif state == Enum.TeleportState.InProgress then
		sendTeleportNotification("Teleporting...", 0)
	elseif state == Enum.TeleportState.Failed then
		sendTeleportNotification("Teleport failed. Insufficient privileges or target place does not exist.", 3)
	end
end

-- The OnTeleport event needs to be used to ensure the teleport doesn't fail
LocalPlayer.OnTeleport:connect(onTeleport)

As to why the messages were removed:

  • Firstly the messages used the now deprecated message object, this is not a reason to remove them by itself but they definitely needed to be changed.
  • Secondly as this thread shows it encourages developers to not have proper error handling for teleporting players.

You should listen for the TeleportFailed enum in the OnTeleport event and use this to silently retry a few times before telling the player that the teleport has failed. Then you need to handle the case where it is failed and retrying isn’t working either.

We can’t do this because it is not backwards compatible. The teleport functions would need to be changed to YieldFunctions for this to work as teleporting involves making a web request. There is however a TeleportState enum which you can access with the OnTeleport event.

Maybe there is a case for more enum items for the TeleportState for better error handling though.