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)
local success, errorMessage, placeId, jobId = pcall(function()
if success then
-- Teleport player
TeleportService:TeleportToPlaceInstance(placeId, jobId, player)
local a, b, c, d = pcall(function()
return "1", "2", "3", "4"
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)
if success and teleSuccess then
-- do tele stuff
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)