PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

GetArrivingTeleportGui

This function returns the customLoadingScreen the Players/LocalPlayer|LocalPlayer arrived into the place with.

Note, the customLoadingScreen will not be used if the destination place is in a different game.

Loading screen

During a teleport, whilst the destination place is loading, the customLoadingScreen is parented to the CoreGui. Once the place has loaded the ScreenGui|loading screen is Instance/Parent|parented to nil.

If you wish to preserve the customLoadingScreen and perform your own transitions, you will need to parent it to the Players/LocalPlayer|LocalPlayer’s PlayerGui. For an example of this, see the code sample below.

Returns

Return Type Summary

The customLoadingScreen the Players/LocalPlayer|LocalPlayer arrived into the place with


Code Samples


Handling a Teleport Loading GUI

The following code, when placed inside a LocalScript in ReplicatedFirst will preserve a custom teleport loading screen for five seconds before destroying it.

local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local ReplicatedFirst = game:GetService("ReplicatedFirst")

local customLoadingScreen = TeleportService:GetArrivingTeleportGui()
if customLoadingScreen then
    local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
    ReplicatedFirst:RemoveDefaultLoadingScreen()
    customLoadingScreen.Parent = playerGui
    -- animate screen here
    wait(5)
    -- destroy screen
    customLoadingScreen:Destroy()
end