Lesson 1 of 4

How to use this course

A short tour of Beacon Yard, the open course for Roblox development. You try every kind of step once, and learn the colour code and the picture the whole course uses for servers and clients.

Concept lesson, about 25 minutes, 10 steps

By the end you can

  • Move through a lesson step by step and switch to the manual when you want to look something up
  • Read the colour code every diagram uses for the server, the client and stored data
  • Answer each kind of question, run a Luau cell and record a challenge pass
  • Export your progress and import it in another browser

1One game, built in the open

By the shipping module you will have shipped Beacon Yard: a small Roblox game where players collect coins from pads, defend a beacon from a drone, and spend what they earn in a shop. The main build covers 15 tagged snapshots from m00-baseplate through m14-ship. Three advanced snapshots continue through m17-live-season. You can download and run the tagged snapshots. This is the whole server script at the third milestone, m02-the-pad: one pad that reports every touch.

local yard = workspace:WaitForChild("Yard")
local pad = yard:WaitForChild("CoinPads"):WaitForChild("Pad1")
if not pad:IsA("BasePart") then
	error("Workspace.Yard.CoinPads.Pad1 must be a part")
end
 
print("[Beacon Yard] server started")
 
pad.Touched:Connect(function(hit: BasePart)
	print(hit.Name .. " touched " .. pad.Name)
end)
Figure 1.1

The yard is the course

The course map, your progress and the game are the same object. When you finish a module, its plot in the yard fills in. Open the course map at any time to see where a lesson sits.

What do the lessons in Beacon Yard build?

  1. One game that grows from an empty baseplate to a shipped release
  2. A new small game in every lesson
  3. Only scripts; the building happens in another course
  4. A website about Roblox
Answer

One game that grows from an empty baseplate to a shipped release. The main build ships one game in 15 snapshots. Three advanced snapshots extend it after shipping.

Open this step in lesson mode · Link to this step · This confused me

2One step at a time

A lesson shows one step at a time. The bar at the bottom of the screen moves you on: Check marks the question in front of you, Continue takes you to the next step, and Skip moves on without answering. On a wide screen the outline on the right lists every step, and you can jump to any of them.

Beacon Yard site
A Beacon Yard lesson in the browser, showing one step with a question, the step outline on the right and the Check bar at the bottom.

Select a numbered pin, or a row below, to read what it marks.

Figure 2.1.

The lesson view. Select a pin, or press Tour the pins, to read what each part does.

Match each control to what it does.

  1. Check
  2. Continue
  3. Skip
  4. This confused me
Answer

Check: Marks the question in this step; Continue: Opens the next step; Skip: Moves on without answering; This confused me: Opens an issue that names this step. Check grades, Continue moves on once every question is settled, Skip moves on anyway, and This confused me tells the authors which step needs work.

Open this step in lesson mode · Link to this step · This confused me

3Lesson or manual

Every lesson also exists as a manual: the same text with numbered sections and figures, every question shown as a question and answer, and the reference sections open. Use the lesson to learn and the manual to look things up later. The toggle under the title switches between them and the site remembers your choice. The lesson view in figure 2.1 is the stepped one.

Figure 3.1.

A lesson in use: answering, checking and moving on. The transcript below has every action.

Transcript
  1. 0:00 The lesson opens at step 1 of 10. The outline on the right lists every step.
  2. 0:03 An answer is picked: one game that grows from an empty baseplate to a shipped release.
  3. 0:04 Check marks it correct and adds 10 XP. The main button now reads Continue.
  4. 0:07 Continue opens step 2. The outline marks step 1 as done, in gold.
  5. 0:09 Selecting pin 1 on the screenshot explains the progress bar.

Which of these are true of the manual view?

  1. Sections and figures are numbered
  2. Questions appear with their answers behind a toggle
  3. Reference sections start open
  4. It has different content from the lesson
Answer

Sections and figures are numbered; Questions appear with their answers behind a toggle; Reference sections start open. The manual is the same lesson laid out for looking things up: numbered, with answers and references at hand. Its content is identical.

Open this step in lesson mode · Link to this step · This confused me

4The colour code

Roblox games run in two places at once. The serverServerThe machine Roblox runs for each copy of your game. It holds the authoritative world.Think of it as the referee with the only real scoreboard. is a machine Roblox runs for each copy of your game, and every player's device is a clientClientOne player's device running its own copy of the game for display and input.Think of it as your screen and controller at home.. Mixing the two up causes many bugs, and cheating mostly comes from a server that trusts what a client says12, so every diagram in this course paints them the same way: copper for the server, cyan for the client, and gold for data that is saved.

Server sideThe server is the referee with the only real scoreboard.
In the pictureIn Roblox
The refereeThe Roblox server running your Scripts
The official scoreboardValues the server owns, such as a player's coins
Calling a foulRejecting a request that breaks the rules

See the whole analogy cast

Picture a sports arena. The server is the arena and the referee holding the only real scoreboard. Each player's client watches a live broadcast at home while holding a controller: it shows a copy of that truth and sends requests, and it never changes the server's values directly.

Think of it as The referee with the only real scoreboard

Changes made by the referee travel out to every screen on the live broadcast:

Both sidesReplication is the live broadcast.
In the pictureIn Roblox
The match in the arenaThe server's instance tree
The broadcast feedProperty and instance changes sent to every client
The delay on the feedNetwork latency

See the whole analogy cast

The arena and the broadcast

The arena and the broadcast: a still of the simulation
Figure 4.1.

Add coins on the server, change a client's copy, and watch which changes travel.

Open this step in lesson mode · Link to this step · This confused me

5Where the picture breaks

Both sidesRemember: Replication is the live broadcast.

A picture helps until it misleads you. Every analogy in this course is broken on purpose once it has done its job, because the place it fails is exactly where the real rule lives. Try to answer before you open it.

Where does it break?“The live broadcast” is a good picture of replication. Where does it stop being true?

It breaks here. Only property changes in some containers are sent, and nothing a client changes ever travels back up to the server.

The true model. The server copies changes in replicated containers, such as Workspace and ReplicatedStorage, down to clients. A client's own changes stay on that client unless it asks the server through a remote.

A LocalScript sets a Part's colour to red on one player's device. What does the server see?

  1. The old colour; the change stays on that client
  2. Red, after a short delay
  3. Red, but only for that player's character
  4. An error, because clients cannot change parts
Answer

The old colour; the change stays on that client. Replication runs from the server down. A client can change its own copy of a part, but the server and every other player keep the old colour.

Open this step in lesson mode · Link to this step · This confused me

6Try a runnable Luau cell

Roblox code is written in LuauLuauThe programming language of Roblox, derived from Lua 5.1 with gradual types and a faster runtime.Think of it as lua with labels on the jars., a fast, typed descendant of Lua that Roblox publishes under the MIT licence3. If you finished the Before you start module, you already know these cells; if you started here, this is your first taste of Luau in the browser. Change the numbers and press Run, or Ctrl+Enter. A cell with a goal checks your output and records a pass.

Luau
local coins = 5
coins += 2
print("Coins:", coins)
Figure 6.1. Expected output: Coins: 7

What does this print?

local coins = 10
local price = 3
coins -= price * 2
print(coins)
  1. 4
  2. 14
  3. -4
  4. 7
Answer

4. price * 2 is 6, and coins -= 6 leaves 4.

Some cells are graded by tests that run after your code. This one fails until spend refuses a purchase the player cannot afford. Run it, read which test failed, then fix the function.

Luau
local function spend(balance, cost)
	-- Return the new balance. If cost is more than balance, refuse:
	-- return the balance unchanged.
	return balance - cost
end
 
print(spend(10, 4))
Figure 6.2. Run it in the lesson view or in the Studio command bar. The lesson view checks it with tests.

Open this step in lesson mode · Link to this step · This confused me

7How working studios set up

Studio's built-in editor is enough for your first scripts. Professional teams usually keep game code in files instead, edited in an external editor and synced into Studio with RojoRojoA tool that syncs files on your disk into Roblox Studio.Think of it as a photocopier from your folder to Studio., so they can use version control, code review and automated tests. This course moves you to that setup in Set up your machine, part 1: Studio, an editor and Git, and each topic shows the main alternatives.

Other ways pros do this

OptionWhat it isWhen pros pick itTrade-offs
Studio script editorThe editor inside Roblox Studio.Solo work, quick fixes and live edits in a running session.Code lives in the place file, so Git cannot diff it and linters cannot run on it.
VS Code with RojoAn external editor plus file sync into Studio.Teams, open-source games and anything with code review or CI.Two windows and a sync tool to keep connected.
Studio Script SyncRoblox's built-in two-way file sync.Script-only projects that want files without extra tools.Scripts only, no project file for models or assets.

This script should give a player 5 coins. Which line is wrong?

local function giveCoins(player, amount)
    local coins = player.leaderstats.Coins
    coins.Value = amount
end
giveCoins(player, 5)
Answer

Line 3: coins.Value = amount. Fixed: coins.Value += amount. Line 3 replaces the balance instead of adding to it. coins.Value += amount keeps what the player already had.

Open this step in lesson mode · Link to this step · This confused me

8Your progress is yours

There are no accounts. Your answers, XP and position in each lesson are saved in this browser's local storage, and the home page can export them to a file and import them elsewhere. This is the function that saves every change, read straight from the site's source:

export function updateProgress(change: (draft: Progress) => void): void {
  const next: Progress = structuredClone(load());
  change(next);
  current = next;
  const raw = JSON.stringify(next);
  if (writeStorage(PROGRESS_KEY, raw)) rawCache = raw;
  emit();
Figure 8.1

Lessons are checked by a content linter before they are published. The output of its last run on this lesson is kept as evidence:

Evidence, figure 8.2lint-content.log
Linting 1 lesson in content/en
  content/en/m0-orientation/roadmap.mdx: 10 steps, 33 blocks
0 problems

Checkpoint

  • I can move between steps with the bar or the arrow keys
  • I know which colour means server, client and saved data
  • I know where to switch to the manual

Build along

m00-baseplate

  1. Answer any question in this lesson correctly on the first try.

    You should see The question's border turns green and +10 XP appears in its corner.

  2. Press Manual under the lesson title, then come back with Lesson.

    You should see The page shows numbered sections, and Manual is selected in the toggle under the title.

  3. On the home page, press Export progress.

    You should see A file named beacon-yard-progress followed by today's date is downloaded.

Open this step in lesson mode · Link to this step · This confused me

9Challenges and pass codes

Each challenge tells you how to check your work. A graded Run cell records completion when it passes. For a Studio test, start a clean branch or worktree from m14-ship (see Set up your machine, part 3: connect, play, and the optional extras: How to start any Studio challenge), run the command shown in the challenge, then paste the BY- code from Output. The first challenge uses the standalone script below. If a Level 1 or 2 challenge has no test, compare your work with the "Done means" list, then choose I did this to record self-reported XP. Pass codes are a way to track practice, not proof of who did the work.

Level 1, Apprentice

Challenge

Prove that Studio runs Luau on your computer. Open a new Baseplate, show the command bar and the Output window, paste this check into the command bar and press Ctrl+Enter (Cmd+Enter on a Mac) or click Run.

luau
local A = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"
local function fnv(s)
	local h = 2166136261
	for i = 1, #s do
		h = bit32.bxor(h, string.byte(s, i))
		h = (h * 403 + bit32.lshift(h, 24)) % 4294967296
	end
	return h
end
local function code(n)
	local out = ""
	for i = 3, 0, -1 do
		local k = bit32.band(bit32.rshift(n, i * 5), 31) + 1
		out ..= string.sub(A, k, k)
	end
	return out
end
local id = "studio-hello"
local h1 = fnv("beacon-yard:pass:" .. id)
local h2 = fnv(tostring(h1) .. ":" .. id)
print("Beacon Yard check passed: BY-" .. code(h1) .. "-" .. code(h2))
Start from
Roblox Studio installed, with a new Baseplate open (skip ahead and return after setup part 1 if Studio is not installed yet)

Done means

  • Studio opens a Baseplate place
  • The command bar runs the check above
  • The Output window shows a pass code you paste here

Hints

  1. Install Studio in setup part 1 and sign in with your Roblox account.
  2. Open the command bar from the Script tab (or the Window menu). It sits at the bottom of the window.
  3. Open Output from the Window menu or the Script tab too, or the printed code has nowhere to appear.
Solution
luau
-- Script tab > Command Bar (with Window > Output or Script tab > Output open), paste, then press Ctrl+Enter (Cmd+Enter on a Mac) or click Run.
-- Prints: Beacon Yard check passed: BY-5WWC-8N27
local A = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"
local function fnv(s)
	local h = 2166136261
	for i = 1, #s do
		h = bit32.bxor(h, string.byte(s, i))
		h = (h * 403 + bit32.lshift(h, 24)) % 4294967296
	end
	return h
end
local function code(n)
	local out = ""
	for i = 3, 0, -1 do
		local k = bit32.band(bit32.rshift(n, i * 5), 31) + 1
		out ..= string.sub(A, k, k)
	end
	return out
end
local id = "studio-hello"
local h1 = fnv("beacon-yard:pass:" .. id)
local h2 = fnv(tostring(h1) .. ":" .. id)
print("Beacon Yard check passed: BY-" .. code(h1) .. "-" .. code(h2))

A level 1 challenge is worth 25 XP, and each level adds 25 more. How much XP is a level 3 challenge worth?

Answer

75 XP. 25 for level 1, 50 for level 2 and 75 for level 3.

Open this step in lesson mode · Link to this step · This confused me

10How every lesson ends

Reference Keyboard shortcuts

Shortcuts work when the focus is not in a text field.

→
Check the open question, or continue to the next step.
←
Go back one step.
1 to 9
Pick an option in the focused question.
Ctrl + Enter
Run the Luau cell you are typing in.
Go deeper Why steps end in an action

Reading an explanation feels like learning, but recalling and using the idea is what makes it stick. That is why at least three in four steps end with something you do: a question, a cell, a simulation or a build step.

Put the parts of a typical step in order.

  1. The idea, named
  2. Something concrete to look at
  3. An action that uses it
  4. Feedback on what you did
Answer

1. Something concrete to look at 2. The idea, named 3. An action that uses it 4. Feedback on what you did. Each step starts concrete, names the idea, asks you to use it, then tells you how it went.

Recap

  1. A lesson is one step at a time; the manual is the same lesson for looking things up.
  2. Copper is the server, cyan is the client and gold is saved data, in every diagram.
  3. Progress, XP and challenge passes stay in your browser; export them to move.

The server is the referee with the only real scoreboard, until the server is also the field itself, and it cannot see things that exist only on a client, such as a player's GUI or a LocalScript's effects.

Replication is the live broadcast, until only property changes in some containers are sent, and nothing a client changes ever travels back up to the server.

Next What Roblox is: experiences, places, Creator Hub and the economy

Open this step in lesson mode · Link to this step · This confused me