/
ReplicatedFirst.yaml
87 lines (77 loc) · 3.35 KB
/
ReplicatedFirst.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: ReplicatedFirst
type: class
category: Scripting
memory_category: Instances
summary: |
A container whose contents are replicated to all clients (but not back to the
server) first before anything else.
description: |
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
`Class.LocalScript|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
`Class.ReplicatedStorage` container instead.
## How can I use ReplicatedFirst?
`Class.LocalScript|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
`Class.LocalScript|LocalScripts` in ReplicatedFirst.
- Its contents replicate before anything else in the game, meaning
`Class.LocalScript|LocalScripts` running in ReplicatedFirst will need to
wait for any objects they require to replicate using
`Class.Instance:WaitForChild()`
- Any objects that are to be used by a `Class.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
`Class.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
inherits:
- Instance
tags:
- NotCreatable
- Service
deprecation_message: ''
properties: []
methods:
- name: ReplicatedFirst:RemoveDefaultLoadingScreen
summary: |
Immediately removes the default Roblox loading screen. Note if any object
has been placed in `Class.ReplicatedFirst`, the default loading screen
will remove after 5 seconds regardless if this function has been called or
not.
description: |
Immediately removes the default Roblox loading screen. Note if any object
has been placed in `Class.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 `Class.LocalScript` in
`Class.ReplicatedFirst`, as scripts in `Class.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.
code_samples:
- Custom-Loading-Screen
parameters: []
returns:
- type: void
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
events: []
callbacks: []