GetPlayerPlaceInstanceAsync returns false to success for players in the same game universe

GetPlayerPlaceInstanceAsync

The function returns a tuple:

1 success bool A bool indicating if the user was found in the same game universe
2 error string An error message in the event of the lookup failing
3 placeId int64 The DataModel/PlaceId of the server the user is in
4 instanceId string The DataModel/JobId of the server the user is in

My script has pcalls and checks to make sure that nothing is going wrong

So the function would return false, “”, number, string even tho the player is in the same game universe

Code
	local Success2, Error2, CanTeleport, Error3, PlaceId, JobId; 
	Success2, Error2 = pcall(function()
		CanTeleport, Error3, PlaceId, JobId = TeleportS:GetPlayerPlaceInstanceAsync(UserId)
		print("Success2",Success2, "CanTeleport",CanTeleport, "Error3",Error3, "PlaceId",PlaceId, "JobId",JobId)
	end)
	if Success2 and not Error2 then
		if CanTeleport and Error3 == '' and typeof(PlaceId) == 'number' and typeof(JobId) == 'string' then
			TeleportS:TeleportToPlaceInstance(PlaceId,JobId,plr)
		end
	end

Output : Success2 true CanTeleport false Error3 “” PlaceId number JobId string

Yes, this has been an issue for a while:

Just check whether the placeId value you get back is not nil instead to check success value.

1 Like

I might be getting similar errors with Teleporting to specific private servers. It’s a fairly low (From reports, I’d hazard a guess at a ~10% fail rate) but users aren’t prompted with a specific error and I haven’t caught it with Sentry yet.

I’ll post here again if I’m able to resolve this or find out a reliable way to replicate.

What kind of errors are we talking about?

Iirc ReserveServer returns a PrivateServer Access Code, TeleportToPrivate Server returns void

There are two issues here:

  • The API is poorly designed. The first return value is not success, but whether or not the player is in the current game.
  • The documentation incorrectly calls the first return value success.

I will fix the documentation. Not sure what can be done about the API.

3 Likes