My game has a hub where players can transport to different game modes/maps,
it utilises TeleportService:Teleport
with pcall
to debug any errors that occur -
script.Parent.MouseButton1Click:Connect(function()
TeleportService:SetTeleportGui(ui)
local success,err = pcall(function()
TeleportService:Teleport(placeID)
end)
if success then
print("User Teleported")
elseif err then
close.Visible = true
heading.Text = 'Error'
body.Text = err
end
end)
Misc parts of the code such as variables have been left out.
I’ve come across two issues while using this,
-
I’m unable to remove the default teleport UI, it overlaps with the custom UI.
-
The body text of my custom UI does not show the error. The
err
pcall event never fires when the teleport fails.
Any help would be appreciated, thanks in advance.