This function returns true if the client has finished loading the game for the first time.
When all initial
Instance|Instances in the game has finished replicating to the client, this function will return true.
Unless they are parented to
LocalScript|LocalScripts will not run while the game has not loaded. The following snippet, ran from a
ReplicatedFirst will yield until the game has loaded:
if not game:IsLoaded() then game.Loaded:Wait() end
DataModel/Loaded, an event that fires when the game has loaded
Instance/WaitForChild, a function which can be used to wait for an individual
Instanceto replicate without having to wait for the whole game to
Whether the client has finished loading the game for the first time
Custom Loading Screen
This sample demonstrates a custom loading screen with a basic
TextLabel. The code should be placed in a
ReplicatedFirst. To expand on this sample with loading screen animations, see the
articles/Custom Loading Screens|Custom Loading Screens article.
local Players = game:GetService("Players") local ReplicatedFirst = game:GetService("ReplicatedFirst") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") -- Create a basic loading screen local screenGui = Instance.new("ScreenGui") screenGui.IgnoreGuiInset = true local textLabel = Instance.new("TextLabel") textLabel.Size = UDim2.new(1, 0, 1, 0) textLabel.BackgroundColor3 = Color3.fromRGB(0, 20, 40) textLabel.Font = Enum.Font.GothamSemibold textLabel.TextColor3 = Color3.new(0.8, 0.8, 0.8) textLabel.Text = "Loading" textLabel.TextSize = 28 textLabel.Parent = screenGui -- Parent entire screen GUI to player GUI screenGui.Parent = playerGui -- Remove the default loading screen ReplicatedFirst:RemoveDefaultLoadingScreen() --wait(3) -- Optionally force screen to appear for a minimum number of seconds if not game:IsLoaded() then game.Loaded:Wait() end screenGui:Destroy()