ReplicatedFirst

Show Deprecated
Not Creatable
Service

A container whose contents are replicated to all clients (but not back to the server) first before anything else.

What is ReplicatedFirst for?

ReplicatedFirst is most commonly used to store LocalScripts and other objects that are essential for the game's start. As the contents of ReplicatedFirst replicate to the client before anything else in the game, it is ideal for creating loading GUIs or tutorials.

For objects that do not need to be replicated first, developers should use the ReplicatedStorage container instead.

How can I use ReplicatedFirst?

LocalScripts placed within ReplicatedFirst will run. This means code for custom loading screens or other ReplicatedFirst uses can be ran at the earliest possible point.

There a number of key considerations developers need to remember when running LocalScripts in ReplicatedFirst.

  • Its contents replicate before anything else in the game, meaning LocalScripts running in ReplicatedFirst will need to wait for any objects they require to replicate using Instance:WaitForChild()
  • Any objects that are to be used by a LocalScript in ReplicatedFirst should also be parented to ReplicatedFirst. Otherwise, they may replicate to the client late, yielding the script and negating the benefit of ReplicatedFirst.

ReplicatedFirst also includes the function ReplicatedFirst:RemoveDefaultLoadingScreen(), which can be used to immediately remove the default Roblox loading screen. Note if any object has been placed in ReplicatedFirst, the default loading screen will remove after 5 seconds regardless if this function has been called or not.

Code Samples

Custom Loading Screen

1local Players = game:GetService("Players")
2local ReplicatedFirst = game:GetService("ReplicatedFirst")
3
4local player = Players.LocalPlayer
5local playerGui = player:WaitForChild("PlayerGui")
6
7-- Create a basic loading screen
8local screenGui = Instance.new("ScreenGui")
9screenGui.IgnoreGuiInset = true
10
11local textLabel = Instance.new("TextLabel")
12textLabel.Size = UDim2.new(1, 0, 1, 0)
13textLabel.BackgroundColor3 = Color3.fromRGB(0, 20, 40)
14textLabel.Font = Enum.Font.GothamSemibold
15textLabel.TextColor3 = Color3.new(0.8, 0.8, 0.8)
16textLabel.Text = "Loading"
17textLabel.TextSize = 28
18textLabel.Parent = screenGui
19
20-- Parent entire screen GUI to player GUI
21screenGui.Parent = playerGui
22
23-- Remove the default loading screen
24ReplicatedFirst:RemoveDefaultLoadingScreen()
25
26--wait(3) -- Optionally force screen to appear for a minimum number of seconds
27if not game:IsLoaded() then
28 game.Loaded:Wait()
29end
30screenGui:Destroy()

Summary

Properties

Events

Methods


Immediately removes the default Roblox loading screen. Note if any object has been placed in ReplicatedFirst, the default loading screen will remove after 5 seconds regardless if this function has been called or not.

Properties

Events

DefaultLoadingGuiRemoved

Roblox Script Security

FinishedReplicating

Roblox Script Security

RemoveDefaultLoadingGuiSignal

Roblox Script Security

Methods

IsDefaultLoadingGuiRemoved

Roblox Script Security

Returns

IsFinishedReplicating

Roblox Script Security

Returns

RemoveDefaultLoadingScreen

void

Immediately removes the default Roblox loading screen. Note if any object has been placed in ReplicatedFirst, the default loading screen will remove after 5 seconds regardless if this function has been called or not.

Developers should run this function from a LocalScript in ReplicatedFirst, as scripts in ReplicatedFirst will execute before anything else.

It is advised to not remove the default loading screen unless the developer wishes to display their own loading screen as an alternative. If the default screen is removed without replacement users will be able to see geometry loading in the background.


Returns

void

Code Samples

Custom Loading Screen

1local Players = game:GetService("Players")
2local ReplicatedFirst = game:GetService("ReplicatedFirst")
3
4local player = Players.LocalPlayer
5local playerGui = player:WaitForChild("PlayerGui")
6
7-- Create a basic loading screen
8local screenGui = Instance.new("ScreenGui")
9screenGui.IgnoreGuiInset = true
10
11local textLabel = Instance.new("TextLabel")
12textLabel.Size = UDim2.new(1, 0, 1, 0)
13textLabel.BackgroundColor3 = Color3.fromRGB(0, 20, 40)
14textLabel.Font = Enum.Font.GothamSemibold
15textLabel.TextColor3 = Color3.new(0.8, 0.8, 0.8)
16textLabel.Text = "Loading"
17textLabel.TextSize = 28
18textLabel.Parent = screenGui
19
20-- Parent entire screen GUI to player GUI
21screenGui.Parent = playerGui
22
23-- Remove the default loading screen
24ReplicatedFirst:RemoveDefaultLoadingScreen()
25
26--wait(3) -- Optionally force screen to appear for a minimum number of seconds
27if not game:IsLoaded() then
28 game.Loaded:Wait()
29end
30screenGui:Destroy()

SetDefaultLoadingGuiRemoved

void
Roblox Script Security

Returns

void