Lesson 2 of 4
Boot order: what runs first
Learn what runs first in a Roblox game. Beacon Yard's server entry script, its written start order, why the wrench exists before the map, how clients wait for the server, and the ReplicatedFirst loading screen.
By the end you can
- Read init.server.luau as two lists, the requires and the start calls, and say why they differ
- Explain why the wrench is created before any call that can yield
- Describe what the ReplicatedFirst loading script waits for, and how long it waits at most
Before this: Client and server: who owns what, ModuleScripts and require
1The player who spawned with nothing in their hand
Imagine you join Beacon Yard a split second after the server starts. The map is still being built and the data store is still loading. Your character spawns. Roblox copies everything in StarterPack into your backpack when a character spawns. If the wrench was not in StarterPack yet, that character spawns with an empty hotbar, and nothing is wrong in any log. StarterPack is copied again on every respawn, so a missed tool costs one life, not forever.
That is a boot-order bug: the right code, run in the wrong order. Beacon Yard's server avoids it with one short list. CombatService.start also has a repair: it gives the wrench to players already in the game and again on every CharacterAdded. Treat that as a safety net, since starting first means nobody ever needs it.
Remotes.init()
WorldLook.start()
-- The wrench has to exist before the first character spawns. MapBuilder
-- and DataService can yield, and StarterPack only copies tools at spawn.
CombatService.start()
local map = MapBuilder.build()
DataService.start()
MonetizationService.start()
CoinService.start(map.pads)
ShopService.start(map.shopPrompt)
local drone = DroneService.start(map.droneSpawn)
RoundService.start({
prompt = map.beaconPrompt,
gateLeft = map.gateLeft,
gateRight = map.gateRight,
setDroneActive = drone.setActive,
})
ExhibitService.start(map.yard)
TeamService.start()
AnnounceService.start()
PolicyProbe.start()
StarterPack copies its tools into a character's backpack when the character spawns. CombatService.start puts the Wrench into StarterPack. Where in the start list should it sit so the very first character already has the wrench?
Answer
Before any call that can yield, such as MapBuilder.build or DataService.start. A call that yields lets the engine run other things, including a character spawning. If the wrench is not in StarterPack by then, that character spawns without it until the give loop or the next respawn fixes it. Starting CombatService first closes the gap.
Open this step in lesson mode · Link to this step · This confused me
2Two lists: require, then start
The server entry script has a block of require lines at the top and a block of start calls below. You met the difference in the modules lesson: a require only runs a module's body, which defines functions and builds tables. A start call is where a service does anything at all: connects events, builds parts, opens the store.
| In the picture | In Roblox |
|---|---|
| Unlocking the doors first | Remotes.init creating the folder everything else uses |
| Lights on before the crowd enters | WorldLook.start setting the lighting before the round stores it |
| Staff at their posts before the whistle | The wrench in StarterPack before any call that can yield |
| The checklist itself | The written start list in init.server.luau |
Starting a game server is opening an arena for the evening. The checklist says which door to unlock first, which lights to turn on before the crowd enters, and who must be at their post before the referee blows the whistle.
Think of it as The opening checklist for the arena
The two lists are allowed to disagree. WorldLook is required tenth of fourteen and started second. MonetizationService is required last and started after DataService, not last.

Select a numbered pin, or a row below, to read what it marks.
The Server script in Studio. Read down the start calls, not the require lines.
Put these m06 calls in the order init.server.luau runs them.
Answer
1. Remotes.init() 2. WorldLook.start() 3. CombatService.start() 4. MapBuilder.build() 5. DataService.start() 6. CoinService.start(map.pads). Remotes first so the folder exists, WorldLook second so the lighting is set before anything stores it, CombatService third for the wrench, then the map, then data, and coins last because they need both.
Open this step in lesson mode · Link to this step · This confused me
3Watch the two lists in a model
The cell below is a toy version of the boot script: three fake services that log when they are required and when they start. The log shows that the order of the requires does not decide the order of the work.
local log = {}
local function service(name)
table.insert(log, "required: " .. name)
return {
start = function()
table.insert(log, "started: " .. name)
end,
}
end
-- the require block: bodies run in this order
local Combat = service("Combat")
local Remotes = service("Remotes")
local WorldLook = service("WorldLook")
-- the start block: the work runs in this order
Remotes.start()
WorldLook.start()
Combat.start()
for _, line in log do
print(line)
end
required: Combat
required: Remotes
required: WorldLook
started: Remotes
started: WorldLook
started: CombatNow swap two of the start calls and run it again. The required: lines stay where they were, because only the start block decides the order of the work.
In m06, WorldLook is required near the end of the require block. What time does it run its work?
Answer
Second, at WorldLook.start(), because the work lives in start and start is called second. Requiring only runs the module body, which defines its functions. The lighting is set inside WorldLook.start, and the boot script calls that second.
Open this step in lesson mode · Link to this step · This confused me
4Each call earns its place
Every position in the list has a reason, usually "this needs that":
- Remotes.init first. It creates the
ReplicatedStorage.Remotesfolder. Every later service fires remotes, and clients wait for that folder. - WorldLook.start second. It sets the dusk lighting. The round stores the current clock when it starts, so the lighting has to be right before then.
- CombatService.start before the map. The wrench has to be in StarterPack before any yield.
- MapBuilder.build before the services that need the map. It returns the pads, the prompts, the gates and the drone spawn.
- DataService.start before anything that reads profiles, including coins, the shop and the receipt handler.
- DroneService.start before RoundService.start, because the round receives the drone's
setActivefunction.
Both sidesRemember: Boot order is the opening checklist for the arena.
Match each start call to the thing it must wait for.
Answer
CoinService.start(map.pads): The pads MapBuilder.build returns; ShopService.start(map.shopPrompt): The shop prompt MapBuilder.build returns; RoundService.start({ ..., setDroneActive = drone.setActive }): The drone service's setActive function; MonetizationService.start(): DataService.start, so a receipt can find a profile. Coins and the shop take parts from the map, the round takes a function from the drone, and receipts need profiles that DataService opens.
Open this step in lesson mode · Link to this step · This confused me
5The client waits for the server
The client has the same problem in mirror. Its scripts start while the server may still be setting up. Hud.luau does ReplicatedStorage:WaitForChild("Remotes"), and WaitForChild yields until the folder exists. A client script that skipped the wait would index a folder that is not there yet.
Roblox also gives clients a head start: anything in ReplicatedFirst is sent before the rest of the game, so a loading screen can show while everything else arrives. Beacon Yard's loading script removes the default screen, shows its own, then polls until the game is loaded and the Remotes folder exists, for at most 8 seconds1.
local TIMEOUT_SECONDS = 8
local player = Players.LocalPlayer
local deadline = os.clock() + TIMEOUT_SECONDS
local playerGui = player:WaitForChild("PlayerGui", TIMEOUT_SECONDS)
if playerGui == nil then
ReplicatedFirst:RemoveDefaultLoadingScreen()
return
end
local gui = Instance.new("ScreenGui")
gui.Name = "BeaconYardLoading"
gui.ResetOnSpawn = false
gui.DisplayOrder = 100
gui.IgnoreGuiInset = true
gui.Parent = playerGui
local sharedFolder = ReplicatedStorage:FindFirstChild("Shared")
local scaleModule = sharedFolder and sharedFolder:FindFirstChild("UiScale")
if scaleModule and scaleModule:IsA("ModuleScript") then
local UiScale = require(scaleModule) :: { attach: (gui: ScreenGui) -> () }
UiScale.attach(gui)
end
local frame = Instance.new("Frame")
frame.Name = "Backdrop"
frame.Size = UDim2.fromScale(1, 1)
frame.BackgroundColor3 = Color3.fromRGB(16, 20, 26)
frame.BorderSizePixel = 0
frame.Parent = gui
local title = Instance.new("TextLabel")
title.Name = "Title"
title.BackgroundTransparency = 1
title.Size = UDim2.fromScale(1, 1)
title.FontFace = Font.new("rbxasset://fonts/families/BuilderSans.json", Enum.FontWeight.ExtraBold)
title.TextSize = 48
title.TextColor3 = Color3.fromRGB(236, 232, 214)
title.Text = "Beacon Yard"
title.Parent = frame
ReplicatedFirst:RemoveDefaultLoadingScreen()
while os.clock() < deadline do
local remotes = ReplicatedStorage:FindFirstChild("Remotes")
if game:IsLoaded() and remotes ~= nil then
break
end
task.wait(0.05)
end
gui:Destroy()
The loading script polls every 0.05 seconds with task.wait(0.05) and gives up after TIMEOUT_SECONDS. At most, how many polls can happen? (Assume each task.wait takes exactly 0.05 seconds.)
Answer
160 polls (within 1). 8 / 0.05 is 160. In practice the screen closes much sooner: once the server has made the Remotes folder, the next poll finds it.
Open this step in lesson mode · Link to this step · This confused me
6Where the checklist picture breaks
A real opening checklist is done by one person who walks through it. Server and client boot in parallel on two machines, and the engine can run other scripts at any yield. The client has no way to know the server finished its list; it can only wait for something observable.
Where does it break?“The opening checklist for the arena” is a good picture of boot order. Where does it stop being true?
It breaks here. A real checklist is walked through by one person. The server and every client boot at the same time on different machines, the engine can run other scripts at any yield, and a client cannot see the server's list: it can only wait for something that replicates.
The true model. Boot order is the order of start calls in one entry script per side. Any call that yields lets the engine run other work, including spawning characters, so what must exist early goes before the first yield, and clients wait on replicated signals such as a folder appearing.
Which of these is a signal the client can actually observe to know the server's Remotes.init has run?
Answer
The Remotes folder appears in ReplicatedStorage. A folder in ReplicatedStorage replicates, so the client can wait for it. A server print never reaches the client's script, and IsLoaded only says the initial instances arrived, not that the server's own setup is done.
Open this step in lesson mode · Link to this step · This confused me
7Build it: mark the order, then read it back
Pros keep boot order explicit and testable. Here are the shapes you will meet.
Ways to order startup
| Option | What it is | When pros pick it | Trade-offs |
|---|---|---|---|
| One entry script with explicit start calls | A written list, as in init.server.luau. | Small and mid-size games, and any team that wants to read boot order in one file. | You maintain the list by hand; forgetting a start call fails quietly. |
| Lifecycle hooks (Init, then Start) | Frameworks such as the archived Knit call every service's Init first, then every Start. | Codebases that grew many services with cross-dependencies. | Hides order behind conventions, and Knit is archived. |
| Dependency injection | Each module declares what it needs and a loader starts things in dependency order. | Large studios with many packages. | More machinery to learn and debug. |
| Auto-load every ModuleScript in a folder | A loop requires and starts everything it finds. | Teams that want no boilerplate. | Start order becomes the order of children, which changes without warning. |
Build along
src/server/init.server.luau
Check out the tag with
git checkout m06-drone-wrench, runrojo serveand connect the plugin.You should see Studio shows the Server script under ServerScriptService, with the services as its children.
In
src/server/init.server.luau, addprint("boot remotes")on the line beforeRemotes.init()andprint("boot policy")on the line afterPolicyProbe.start(). Press Play and filter Output to the server.You should see Output shows boot remotes first and boot policy last, both from the server.
Stop and remove both prints with
git checkout -- src/server/init.server.luau.You should see git status shows a clean working tree.
Open this step in lesson mode · Link to this step · This confused me
8Challenges
Level 1, Apprentice
Challenge
Write the server start order from memory, then check it.
- Start from
- The game at milestone m06 (download)
Done means
- You write the start list from Remotes.init through PolicyProbe.start from memory
- You mark which calls have a comment explaining their position
Hints
- Check your list against the Source block in this lesson.
- Only the wrench has a comment in the m06 file.
Solution
Remotes.init, WorldLook.start, CombatService.start, MapBuilder.build, DataService.start, MonetizationService.start, CoinService.start, ShopService.start, DroneService.start, RoundService.start, ExhibitService.start, TeamService.start, AnnounceService.start, PolicyProbe.start
This client snippet works in Studio on your fast machine and fails for some real players. Which line is the bug?
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local folder = ReplicatedStorage:FindFirstChild("Remotes")
local shopBuy = folder:WaitForChild("ShopBuy")
shopBuy:FireServer("Speed")
Answer
Line 2: local folder = ReplicatedStorage:FindFirstChild("Remotes"). Fixed: local folder = ReplicatedStorage:WaitForChild("Remotes"). FindFirstChild returns nil immediately if the server's Remotes.init has not run, and the next line then indexes nil. WaitForChild yields until the folder appears.
Level 2, Builder
Challenge
Find where the client waits for the server, and say what breaks without the wait.
- Start from
- The game at milestone m06 (download)
Done means
- You open src/client/init.client.luau and src/client/Hud.luau
- You find the line where the client waits for the Remotes folder
- You explain what would happen if it used FindFirstChild instead of WaitForChild
Hints
- Search Hud.luau for WaitForChild.
- FindFirstChild returns nil at once if the folder is not there yet.
Level 3, Professional
Challenge
Leave a mark in the live server that the wrench started before the map. The solution is challenges/solutions/boot-order.md in the game repo.
- Start from
- The game at milestone m06 (download)
- Grade it
- To grade work from an earlier milestone, apply your challenge changes to a checkout based on
m14-ship, which includes the Course Runner. In Studio, press Play, then rungame.ServerScriptService.RunGameTests:Invoke("boot-order")in the server command bar. Copy the pass code from Output.
Done means
- init.server.luau sets workspace attribute WrenchBeforeMap to true
- Self-check, the test cannot see it: the attribute is set on the line after CombatService.start() and before MapBuilder.build(), and the wrench still starts before the map
- The Course Runner prints TEST PASS boot_wrench_before_map and a pass code
Hints
- workspace:SetAttribute("WrenchBeforeMap", true) is visible from any side.
- The test also checks a Wrench exists in StarterPack, the backpack or the character.
- If you set it after MapBuilder.build you have missed the point of the comment.
Open this step in lesson mode · Link to this step · This confused me
9Recap
Retiring the analogy
You no longer need “the opening checklist for the arena”. Boot order is the order of start calls in one entry script per side. Any call that yields lets the engine run other work, including spawning characters, so what must exist early goes before the first yield, and clients wait on replicated signals such as a folder appearing.
Recap
- init.server.luau has two lists. Requires only run module bodies; the start calls do the work, in an order written by hand, so WorldLook can be required late and started second.
- Each position has a reason: Remotes before anything that fires, the wrench before any call that yields, the map before what needs its parts, data before anything that reads profiles.
- The client cannot see the server's list. It waits for something that replicates, such as the Remotes folder, and ReplicatedFirst lets a loading screen run before the rest arrives, for at most 8 seconds.
Boot order is the opening checklist for the arena, until a real checklist is walked through by one person. The server and every client boot at the same time on different machines, the engine can run other scripts at any yield, and a client cannot see the server's list: it can only wait for something that replicates.
Queued for review
- StarterPack copies its tools into a character's backpack when the character spawns. CombatService.start puts the Wrench into StarterPack. Where in the start list should it sit so the very first character already has the wrench?
- Put these m06 calls in the order init.server.luau runs them.
- In m06, WorldLook is required near the end of the require block. What time does it run its work?
- Match each start call to the thing it must wait for.
- Which of these is a signal the client can actually observe to know the server's Remotes.init has run?
Open this step in lesson mode · Link to this step · This confused me