We use cookies on this site to enhance your user experience

Handling a Teleport Loading GUI

Handling a Teleport Loading GUI

Sep 06 2018, 3:05 AM PST

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