TeleportService:GetPlayerPlaceInstanceAsync Error?

I’m trying to make when the player clicks the GUI button it fires the remote event and teleports the player to another player in a different instance but the same game.

My current Event: game.ReplicatedStorage:WaitForChild("Functions"):WaitForChild("MessagingService").OnServerEvent:connect(function(player)

	print(tonumber(script.PlayerUserId.Value))
	
	local success, errorMessage, placeId, jobId = pcall(function()
		
		return TeleportService:GetPlayerPlaceInstanceAsync(tonumber(script.PlayerUserId.Value))
			
	end)
		
	if success then
		
		print("Success!")
		
		-- Teleport player
		TeleportService:TeleportToPlaceInstance(placeId, jobId, player)
		
	else
		
		warn(errorMessage)
		
	end
	
end)
Screenshot of code:

Output:

image

Misleading?


local a, b, c, d = pcall(function()
    return "1", "2", "3", "4"
end)

print(a) -- true
print(b) -- 1
print(c, d) -- 2, 3
-- 4 is nowhere to be found

Assume that placeId became errorMessage, placeId became jobId and jobId is missing.
Someone posted about the misleading example in the wiki, so they suggested a different method:

local teleSuccess, teleErrorMessage, placeId, jobId
local success, errorMessage = pcall(function()
     teleSuccess, teleErrorMessage, placeId, jobId = TeleportService:GetPlayerPlaceInstanceAsync(followId)
end)

if success and teleSuccess then
     -- do tele stuff
end
2 Likes

Thank you so much it helped, but now it shows that the place is restricted? But it’s obviously not.

image

Must be a valid place teleportation, that the place is the starting place if it’s in another game.

1 Like

People can’t teleport from a VIP server to a normal server?

And ONLY people there’s already in the server can be teleported oof

Weird. It should actually work if they were teleported within the same game, different place.

Are you certain that the place teleportation is failing at all times?

Oop, just 10 min before it didn’t work. Now it does? Well thank you!

Here’s the code I used:

1 Like

I made a bug report on this since the example on the api page was misleading.

The way you have it set up in your last reply is what I do. Be careful though, sometimes the pcall success will return nil even though it actually worked.
It may be safer to check if the placeid and jobid are not nil. (Unless this is fixed already)

6 Likes

Alright, thank you! :white_check_mark: :smiley:

Edited one last sentence onto my reply just Incase you didn’t see it! Good luck! :slight_smile:

1 Like