Skip to main content

Stage 4: Lava Touch

Roblox Studio · Creator QuestStage 4 of 10
~55 min0/4 proofs0 XPRookie Builder
Stage 4 goal preview: Build a hazard field and code your first touch event
Quest objectiveBuild a hazard field and code your first touch event

Your players can choose their path now, saved at Checkpoint_04. But so far, your world just stands there. Today it fights back — because today you write your first Lua.

Narration transcript
  1. Stage Three gave your players a real choice and saved it at Checkpoint zero four. Keep that tested checkpoint open. Stage Four begins there.
  2. Build a hazard field in your world, learn event, check, and action, and ship your first Lua script.
  3. Spoken bridge: Mission ready. First, understand the idea that makes this stage work.
Build

a hazard field in your world that reacts to the player

Learn

how an event starts a Lua instruction

Ship

your first working script

Idea

Narration transcript
  1. Until now your game only watched players move. Event-driven code lets it react. A touch is the event, finding a Humanoid is the check, and changing Health is the action. Your hazard can look like anything — lava, slime, freezing water — because the script lives inside the part it guards and never looks at its name. The name Lava is for you: it keeps your Explorer readable.
  2. Spoken bridge: Turn that idea into three small Logic Cards.

An event is something the game notices. "A part was touched" is an event. An event handler answers: "When that happens, what should the game do?" Your handler will run a check (is this a player?) before its action (change their Health). Event, check, action — the shape of almost every game script you'll ever write.

Today is your first Lua. You'll type one small piece at a time, run it, and see it work. Punctuation and capital letters matter. And here's the secret: your script will live inside the hazard part, so it never even looks at the name. Lava is a name for you — it keeps your Explorer readable. On screen, the part can be anything your world needs.

Sample goal
Six purple stepping stones crossing a glowing orange lava floor between checkpoints
Build toward this: One way Stage 4 can look: a bright hazard floor with safe stones zigzagging across. Your hazard, your layout — what matters is the crossing reads at a glance.

Logic Board

Logic board

Finish these cards from left to right. Each card becomes a Code Quest below.

  1. 1Card A
    Narration transcript
    1. Build a readable hazard field with safe stones across it.
    2. The safe route is readable before the player jumps.

    Show danger

    Build a readable hazard field with safe stones across it.

    Done when: The safe route is readable before the player jumps.
  2. 2Card B
    Narration transcript
    1. Connect the Touched event and prove it with a print.
    2. Output prints whatever touches the hazard.

    Listen for touch

    Connect the Touched event and prove it with a print.

    Done when: Output prints whatever touches the hazard.
  3. 3Card C
    Narration transcript
    1. React only to players, then save the checkpoint.
    2. The hazard respawns players and Checkpoint zero five saves.
    3. Spoken bridge: The plan is complete. Pick your Build Mode on the page and build one card at a time — pause after every Studio action.

    Check, act, save

    React only to players, then save the checkpoint.

    Done when: The hazard respawns players and Checkpoint_05 saves.

Build

Pick your Build Mode for the geometry — the script afterward is the same for everyone, because the code is the lesson.

Build Mode

Every builder plays this stage in their own mode. Which sounds like you?

Not sure? Start with Guided — you can level up on any stage, and your pick follows you through the whole course.

The wiring

Names that must match

Build inside Workspace → Course → Stage04, from Checkpoint_04 to Checkpoint_05. The scripts here live inside the parts they control — no name hunting yet. These names keep your Explorer readable and your stage debuggable. In Stage 7, scripts start finding parts by name — then spelling becomes law.

  • LavaThe hazard surface your script watches.Must have: Anchored true · Material Neon · Script: LavaHazard
  • Stone_1–6Safe stones across the hazard. Build 4 to 8 — your call.
  • Landing_05The landing that ends the stage — Checkpoint_05 stands here.
Reference buildStuck, or just want to copy ours? Here is exactly how we built this stage.

These values always work together. Copy them as-is, or borrow a few and keep the rest of the stage yours.

Build this part

Lava

Part · Block
Open recipe
Size
24 × 1 × 68
Color
Bright orange
Material
Neon
Anchored
✓ Yes
Orientation
0 × 0 × 0
CanCollide
✓ Yes
Place
Position [0, 1.5, 221] inside Workspace → Course → Stage04

Children: Script: LavaHazard.

Build this part

Stone_1–6

6 Parts · Block
Open recipe
Size
6 × 1 × 6
Anchored
✓ Yes
Orientation
0 × 0 × 0
CanCollide
✓ Yes
Place
1: [-4, 3.5, 195] · 2: [4, 3.5, 205] · 3: [-4, 3.5, 215] · 4: [4, 3.5, 225] · 5: [-4, 3.5, 235] · 6: [4, 3.5, 245] inside Workspace → Course → Stage04
Build this part

Landing_05

Part · Block
Open recipe
Size
12 × 1 × 12
Anchored
✓ Yes
Orientation
0 × 0 × 0
CanCollide
✓ Yes
Place
Position [0, 3.5, 258] inside Workspace → Course → Stage04

Code

Build quest · Card A

Build the hazard field

Narration transcript
  1. Build your hazard field inside Stage zero four: a wide danger surface named Lava with safe stones crossing it, laid out your way per your track. Cross the stones once — the hazard does not hurt yet.
  2. Spoken bridge: Card A now matches its success check. Continue to Card B.

A — Show the danger. Build your hazard field inside Stage04: a wide danger surface named Lava with safe stones crossing it, laid out your way per your track. Cross the stones once in Play mode — the hazard doesn't hurt yet. That's next.

Build quest · Card B

Listen for the event

Narration transcript
  1. First prove the event fires. A print is a programmer's flashlight — it shows you the invisible.
  2. Insert a Script named LavaHazard inside Lava, type the Touched connection with its print line, then press Play, touch the hazard, and watch Output.
  3. Spoken bridge: The behavior passed its focused test. Finish the checkpoint handoff.

First prove the event fires. A print is a programmer's flashlight — it shows you the invisible.

B — Listen. Insert a Script inside Lava, rename it LavaHazard, delete the placeholder, and type the connection below. Press Play, touch the hazard, and watch Output.

  • local creates a name this Script can use.
  • script.Parent means the Lava part holding this Script.
  • Touched is the event. otherPart is the information the event gives your function.
  • Each end closes one open block.
local lava = script.Parent

lava.Touched:Connect(function(otherPart)
print("Lava touched by", otherPart.Name)
end)

If a name prints in Output, your game just noticed something for the first time.

Build quest · Card C

Check the player, then save

Narration transcript
  1. Replace the print with the Humanoid check and the damage action, compare the finished script, and test both surfaces. Then add Landing zero five and complete the Checkpoint zero five recipe.
  2. Spoken bridge: The next checkpoint saved. One designer check before you style it: does your stage pass?

C — Check, act, save. Replace the print line with the check and action below, compare the finished script, and test both surfaces. Then add an anchored Landing_05 at the end of your crossing (reference: [12, 1, 12]) and complete the checkpoint recipe.

local character = otherPart.Parent
local humanoid = character:FindFirstChildOfClass("Humanoid")

if humanoid then
humanoid.Health = 0
end

Keep the earlier first and last lines. A player touching the hazard should respawn; ordinary parts cause no error.

Compare your finished script
local lava = script.Parent

lava.Touched:Connect(function(otherPart)
local character = otherPart.Parent
local humanoid = character:FindFirstChildOfClass("Humanoid")

if humanoid then
humanoid.Health = 0
end
end)
Checkpoint recipeSave progress at Stage 5

Using the voice guide? It reads one recipe step, waits while you work, then continues when you choose Done — hear next step.

  1. Insert one SpawnLocation in Workspace and rename it Checkpoint_05. Set Size to about [6, 1, 6] and Anchored to true. Centered on the landing that ends Stage 4, with its top just above the landing surface. (Our reference build puts it at Position [0, 4.5, 258].)
  2. Set Neutral to false, Enabled to true, and AllowTeamChangeOnTouch to true.
  3. Set the SpawnLocation TeamColor to Bright violet. Set its visual BrickColor to the same named color. TeamColor controls respawning; BrickColor only controls what the pad looks like.
  4. Point at Teams in Explorer, select its +, and insert one Team named Stage 5. Set its TeamColor toBright violet and AutoAssignable tofalse. Never reuse this TeamColor on another checkpoint.
  5. Press Play. Climb to and touch Checkpoint_05, then reset your character and confirm you respawn there. Press Stop before editing again.
Explorer checkWorkspace → Checkpoint_05Teams → Stage 5 (Bright violet)

Does It Pass?

Narration transcript
  1. Time for the designer check. Play your crossing and walk the pass list: danger a player reads at a glance, a fair stone route, a hazard that hurts while every stone stays safe, and a clean Output. A rule that fails is just the next thing to tune.
  2. Spoken bridge: Your stage passes — it is a real level now. Time to make it feel like your game.
Designer check

Does your stage pass?

Play your stage and check each one. A rule that fails isn't a mistake — it's just the next thing to tune.

  • Nothing moves, falls, or drifts — every part stays exactly where you put it.Check: Press Play — everything stays put.Tip: Anchored on for every part, and CanCollide on for anything players stand on.
  • The dangerous surface looks dangerous at a glance — bright, glowing, unmistakable.Check: A player names the danger before touching anything.Tip: Neon material says do-not-touch in every world — slime, void, or ice.
  • Safe stones cross the hazard, and every jump can be made — no luck needed.Check: Cross on the stones three times without falling in.Tip: Stone-to-stone gaps up to about 7 studs work with a running jump; keep calm 3–5 stud hops near the start.
  • Touching the hazard damages the player; every stone stays safe.Check: Touch both in one playtest and watch your health bar.

Make It Yours

Narration transcript
  1. Your hazard IS your world. Its name stays Lava in Explorer — on screen it can be slime, void, or freezing water. Recolor it, pick its material, and make the danger belong to your game.
  2. Spoken bridge: That is your stamp on the stage. Now explain what made it work.

Your hazard IS your world. Its name stays Lava in Explorer — on screen it can be bubbling slime, freezing water, or the void between sky islands. Recolor it, pick its material, and make the danger belong to your game. That's the split every developer learns: what the computer needs (the name) versus what the player sees (your world).

Help Ladder

Stuck? Choose what went wrong

Pick the problem that matches. Open one clue, try it, then return only if you still need help.

My parts overlap or miss the next checkpoint

Clue 1: small hint
Narration transcript
  1. Stop Play mode and check one part against the stage rules before touching anything else.
Stop Play mode. Fix one part at a time instead of dragging the whole stage.
Clue 2: where to look
Narration transcript
  1. Check Workspace, Course, Stage zero 4, and keep both checkpoints directly inside Workspace.
Find the stage parts in Workspace → Course → Stage04. Find Checkpoint_04 and Checkpoint_05 directly inside Workspace.
Clue 3: worked answer
Narration transcript
  1. Walk your stage rules top to bottom and fix the first rule that fails. If you want a layout that always works, open the reference build and copy its values.
Rebuild the connection one part at a time: check each part against the stage rules, or re-enter its reference Position from the matching recipe card if you want the layout that always works. Then playtest again from Checkpoint_04.

the hazard does nothing

Clue 1: small hint
Narration transcript
  1. First decide whether the event or the player check is failing.
First decide whether the event or the player check is failing.
Clue 2: where to look
Narration transcript
  1. Restore the print line and watch Output, and confirm the Script is indented beneath Lava in Explorer.
Restore the print line and watch Output. Also confirm the Script is indented beneath Lava in Explorer.
Clue 3: worked answer
Narration transcript
  1. The Script starts with local lava equals script dot Parent, connects lava dot Touched, finds the Humanoid from otherPart dot Parent, and sets Health to zero inside the if block.
The Script starts with local lava = script.Parent, connects lava.Touched, finds Humanoid from otherPart.Parent, and sets Health to 0 inside the if block.

Learn What Happened

Narration transcript
  1. The Touched event supplied the part that hit. The script checked for a Humanoid before acting, so only characters take damage. Event, check, action — the shape of almost every game script you will ever write.
  2. Spoken bridge: Use one small prediction to transfer that idea.

script.Parent found your hazard because the Script lives inside it — the name never entered the code, which is why the look didn't matter either. The name is for you and your Explorer. (In Stage 7, scripts start hunting parts by name — then spelling becomes law.) Touched supplied the touching part. The if condition protected the action: Health changes only when the toucher belongs to a character with a Humanoid. Event, check, action.

Try This

Narration transcript
  1. Predict what happens if the Humanoid check is removed, compare that with the current safe behavior, and connect each script section to event, check, or action.
  2. Spoken bridge: Finish with four proof checks. Each check must match something you can observe or explain.
Learning beat

Try this

Three short thinking checks. Use evidence from the stage you just built.

Predict first
What prints if a loose Part falls onto your hazard?
Compare
Compare a glowing hazard with one that matches the floor. Which feels fair?
Connect
Match event, check, and action to Logic cards B and C.

Prove It

Narration transcript
  1. Spoken bridge: Final proof. Confirm one result at a time.
  2. A player can see which surfaces are dangerous before touching them, and there is a fair path across.
  3. Lava damages the player and every safe stone stays safe.
  4. Checkpoint_05 saves progress and reset returns you there.
  5. You can identify the event, check, and action in the script.
Mission check · finish all 4

0 of 4 proof checks complete

Narration transcript
  1. Stage Four complete. Your world reacts now — you wrote real Lua and earned one hundred XP. Stage Five teaches your platforms to disappear.

Go Further (Optional)