Learning Goals 3 min
By the end of this lesson you will be able to:
- Drag a stop [all v] block to the bottom of a script and explain what it halts.
- Change the dropdown to stop [this script v] and explain why it's gentler than stop all.
- Build a forever loop that breaks itself out after a few seconds, using a wait and a stop [this script v].
Warm-Up 7 min
Last lesson the cat danced inside a forever loop — it never stopped on its own. You had to press the red stop sign. Today you teach the cat to stop its own script and end the show cleanly.
Quick-fire puzzle
Priya built this stack. She clicked the green flag. What did the cat do?
when flag clicked
move (50) steps
stop [all v]
move (50) steps
Reveal the answer
The cat moved 50 steps — once. The second move (50) steps never ran, because the stop [all v] block halted the script (and every other script in the project) before Scratch even looked at it. Once stop all runs, nothing else gets a turn.
New Concept — the stop cap block and its two flavours 15 min
Think of stop as a full stop in a sentence. Once it runs, the sentence is over. But this full stop has a dropdown — and the dropdown changes how much it stops.
Blocks reference
| Block | Category | What it does |
|---|---|---|
| stop [all v] | Control | Stops every script in the project — on every sprite, on the Stage, all of them. Just like pressing the red stop sign. |
| stop [this script v] | Control | Stops only the stack of blocks that this one is part of. Other scripts on other (or the same) sprite keep running. |
The shape of a cap block
Stop blocks are caps. A cap block has a notch on top (so it can snap under other blocks) but a smooth, flat bottom (no notch). Nothing can ever snap below a cap, because nothing below it would ever run.
when flag clicked
say [Goodbye!] for (1) seconds
stop [all v]
The dropdown — the heart of today's lesson
Click on the white menu in the middle of the stop block. Two main options appear:
- all → stop [all v]. Halts everything in the project. The red stop sign in block form. Loud.
- this script → stop [this script v]. Halts only this stack. Quiet. Polite. Surgical.
(There's a third option — "other scripts in sprite" — which is for later. Stick to the first two for now.)
When to use which
| Situation | Use |
|---|---|
| "Game over — stop the whole game." | stop [all v] |
| "This sprite's dance is done — but keep the music going." | stop [this script v] |
| "After three seconds, end my forever loop but let other sprites carry on." | stop [this script v] |
| "The player crashed the spaceship — end everything." | stop [all v] |
Why it matters
Knowing how to stop a script — without pressing the red sign — is what makes a project feel finished. A game without a clean ending feels like a mistake. A polite "this script is done, the rest of you carry on" is what lets several sprites act independently.
Worked Example — a forever that ends itself 15 min
Open Scratch. Centre the cat (x = 0, y = 0, Direction = 90). We'll build two scripts on the same sprite: a forever loop that makes the cat slide right, and a second script that waits three seconds then politely ends the forever.
Step 1 — Build the forever loop
Drag when ⚑ clicked from Events. Drag forever from Control under it. Drop move (10) steps inside the forever's mouth. Add if on edge, bounce under that. This is the bouncing-cat pattern from last lesson.
when flag clicked
forever
move (10) steps
if on edge, bounce
end
Step 2 — Add a second script on the same sprite
Drag a second when ⚑ clicked hat block. Drop it somewhere else in the Script Area, not touching the first script. Both scripts will start when the flag is clicked — they run side by side.
Step 3 — Wait three seconds
Snap wait (1) seconds under this new hat. Change the 1 to 3.
Step 4 — Add stop all (then switch its dropdown)
Snap stop [all v] under the wait. Click the dropdown. Change all to this script.
when flag clicked
wait (3) seconds
stop [this script v]
Step 5 — Run it. Predict, then watch.
Click the green flag. The cat starts bouncing — script 1 is doing its job. Meanwhile, script 2 is waiting. After three seconds, script 2 hits its stop [this script v].
What stops? Only script 2 stops. Script 1 — the forever loop — keeps running. The cat keeps bouncing.
Wait — that's not what we wanted! Let's fix it.
Step 6 — Put the stop inside the forever
Delete script 2. Instead, move the wait + stop into the body of the forever, so the forever stops itself.
when flag clicked
forever
move (10) steps
if on edge, bounce
wait (3) seconds
stop [this script v]
end
Step 7 — Run it again
Click the flag. The cat bounces. After three seconds, the loop's body reaches its own stop [this script v] — and the forever halts. The cat freezes. The whole project is still alive (the flag is still active, you didn't press red stop), but this particular script is done.
What changed: stop [this script v] stops only the stack it sits in. Putting it inside the forever's body means "stop the forever I'm part of". Putting it in a separate stack stops a different stack — not the forever.
The full assembled stack (your reference)
when flag clicked
forever
move (10) steps
if on edge, bounce
wait (3) seconds
stop [this script v]
end
Try It Yourself — three small builds 12 min
Goal: Make a polite spin. The cat spins forever, but stops itself after five seconds.
when flag clicked
forever
turn cw (5) degrees
wait (0.05) seconds
end
when flag clicked
wait (5) seconds
stop [all v]
Think: Here we use stop [all v] deliberately — it stops the spin and any other scripts. Two parallel scripts on the same sprite. After 5 seconds, everything halts.
Goal: Make a polite hop. The cat hops twenty times (using repeat (10)) — then says "Done!" — then explicitly stops the script even though the loop already finished.
when flag clicked
repeat (20)
move (5) steps
wait (0.05) seconds
end
say [Done!] for (1) seconds
stop [this script v]
Think: The stop [this script v] at the bottom isn't strictly needed — the script ends naturally after the say block. But it makes the ending explicit. Useful when you read your own code three days later.
Goal: Two foreverers, only one stopper. Build two parallel scripts: one that bounces the cat, one that spins it. Then add a third script that waits two seconds and stops only the spinning one.
Hint: stop [this script v] belongs inside the spinning loop's body (after a wait), not in a separate stack — because "this script" means "the stack I'm sitting in".
when flag clicked
forever
move (5) steps
if on edge, bounce
end
when flag clicked
forever
turn cw (3) degrees
wait (0.05) seconds
wait (2) seconds
stop [this script v]
end
Think: The first forever (bouncing) keeps running forever. The second forever (spinning) does one pass, waits two seconds, then stops itself. The cat ends up sliding back and forth at a fixed angle. Try swapping the stop to stop [all v] — both scripts halt.
Mini-Challenge — two scripts, only one stops 5 min
"The polite stopper"
Build a project on Aiman's cat with two scripts: one slides the cat right forever; the other says "Selamat tinggal!" ("Goodbye!") once, four seconds after the flag is clicked, and then ends only itself. The bouncing should keep going.
It works if:
- You click the green flag once.
- The cat slides and bounces forever (until you press red stop).
- Four seconds in, the cat says "Selamat tinggal!" for one second.
- The script that said the goodbye stops itself — the bouncing continues.
Reveal one valid solution
when flag clicked
forever
move (10) steps
if on edge, bounce
end
when flag clicked
wait (4) seconds
say [Selamat tinggal!] for (1) seconds
stop [this script v]
Two scripts, both started by the flag. The first runs forever and is not affected. The second waits, says goodbye, then ends — leaving the first one bouncing on. If we'd used stop [all v] instead of stop [this script v], both scripts would have ended and the cat would have frozen mid-bounce.
Recap 2 min
Today you met the stop cap block — and its dropdown. stop [all v] halts the whole project; stop [this script v] halts only the stack it sits in. You used the polite version to make a forever loop end itself after a timed wait — your first taste of a script that knows how to finish.
- stop [all v] (block)
- A Control cap block that halts every running script in the project. The block-form of the red stop sign.
- stop [this script v] (block)
- A Control cap block that halts only the stack it is in. Other scripts on this sprite, and on other sprites, keep running.
- Cap block
- A block with a notch on top but no notch on the bottom. Nothing can snap under a cap block — caps end a stack.
- Dropdown
- A small menu inside a block (here:
allvsthis script). Click the white arrow to change which option is selected.
Homework 1 min
The Ten-Second Dance. Build a project where Hafiz's cat spins forever — but exactly ten seconds after the green flag is clicked, the spin politely ends and the cat says "Habis!" ("Finished!").
- Open Scratch. Centre the cat. Direction =
90. - Build these two scripts on the same sprite:
when flag clicked
forever
turn cw (5) degrees
wait (0.05) seconds
end
when flag clicked
wait (10) seconds
say [Habis!] for (2) seconds
stop [all v]
Bring back next class:
- A screenshot of your Script Area showing both scripts.
- Your written answer to this question: "If you changed stop [all v] in the second script to stop [this script v], what would happen after the cat says 'Habis!'? Would the spin stop or keep going? Why?"
Heads up for next class: SCR-L01-22 is your first project lesson in this cluster — a full Dance Routine that uses repeat, forever, motion, and say all in one little choreography.