Hey! I’ve trying to make a custom teleporting screen, but when I do the function TeleportService:GetArrivingTeleportGui()
it returns nil in the other place.
Place #1 | Local script located in StarterPlayerScripts
--!strict
--// SERVICES
local PS = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local TPS = game:GetService("TeleportService")
--// VARIABLES
--//--// REMOTE FUNCTIONS
local SetPlayersTeleportGui = RS.Communication.Remote.Events.SetPlayersTeleportGui
--//--// GENERAL
local PlayerGui = PS.LocalPlayer:WaitForChild("PlayerGui")
--//--// GUI OBJECTS
local TeleportInterface = script:WaitForChild("TeleportInterface")
--// MAIN
SetPlayersTeleportGui.OnClientEvent:Connect(function()
TeleportInterface.Parent = PlayerGui
TPS:SetTeleportGui(TeleportInterface)
end)
Place #2 | Local script located in ReplicatedFirst
--!strict
--// SERVICES
local PS = game:GetService("Players")
local RF = game:GetService("ReplicatedFirst")
local RS = game:GetService("ReplicatedStorage")
local TPS = game:GetService("TeleportService")
local TS = game:GetService("TweenService")
--// VARIABLES
--//--// SETTINGS
local Settings = RS:WaitForChild("Settings")
local SecondsUntilServerLock = Settings:WaitForChild("SecondsUntilServerLock")
--//--// CONSTANTS
local _OnTeleportGuiArrivedCooldown: number = 2
local _TransitionDuration: number = 0.5
local _TransitionEasingStyle: Enum.EasingStyle = Enum.EasingStyle.Exponential
--//--// GUI OBJECTS
local TeleportingInterface = TPS:GetArrivingTeleportGui()
--// MAIN
print(TeleportingInterface) -- prints "nil"
if (TeleportingInterface) then
RF:RemoveDefaultLoadingScreen()
local PlayerGui = PS.LocalPlayer:WaitForChild("PlayerGui") :: PlayerGui
TeleportingInterface.Parent = PlayerGui
-- there's still more code, but i don't think they're the issue
end