im making a lobby system with puplic and unlisted lobbys and im trying to catch teleportation errors and yesterday it worked fine but now that im back to continue working on it the error catching stopped working.
Im using pcall and ive read about TeleportService.TeleportInitFailed
but i dont want to rewrite most of my script, and i dont know it it works with my system that i currently have
local TeleportToLobby = function(plr,LobbyID)
local s,TeleportFail = pcall(function()
TeleportService:TeleportToPrivateServer(game.PlaceId,LobbyID,{plr})
end)
print(s,TeleportFail)
if TeleportFail then
warn("Teleport failed: "..TeleportFail)
print("Retrying Teleport")
for i=1,3,1 do
local s,f = pcall(function()
TeleportService:TeleportToPrivateServer(game.PlaceId,LobbyID,{plr})
end)
if not f then
return
end
task.wait(5)
warn("Teleport Failed, try #"..i)
TeleportFailed:FireClient(plr,i,"Teleport")
end
task.wait(5)
TeleportFailed:FireClient(plr,nil,"Teleport")
end
return s
end