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

LocalPlayerArrivedFromTeleport

This function fires when the Players/LocalPlayer enters the place following a teleport. The teleportData and customLoadingScreen are provided as arguments.

When fetching teleportData and the customLoadingScreen you are advised to use TeleportService/GetLocalPlayerTeleportData and TeleportService/GetArrivingTeleportGui instead. This is because these functions can be called immediately without having to wait for this event to fire.

This event should be connected immediately in a LocalScript parented to ReplicatedFirst. Otherwise, when the connection is made the event may have already fired.

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 example, using the following code inside a LocalScript in ReplicatedFirst:

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

TeleportService.LocalPlayerArrivedFromTeleport:Connect(function(customLoadingScreen, teleportData)
    local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
    ReplicatedFirst:RemoveDefaultLoadingScreen()

    customLoadingScreen.Parent = playerGui
    -- animate screen here
    wait(5)
    -- destroy screen
    customLoadingScreen:Destroy()
end)

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

Parameters

Name Type Default Description

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

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