← Years 5–6 Creating Digital Solutions

Building a button with 'when this sprite clicked'

An event block that starts its script when the user clicks that sprite, so the sprite works like a button. Add a label to the sprite and a colour change to show it can be clicked.

Understanding Building a button with 'when this sprite clicked' in Years 5–6 Creating Digital Solutions

What it does: A text label like Start on the sprite tells the user what will happen when they click it. The click event block starts the script, and the next block is the action that happens when the button is pressed. A colour change shows the user the button has been clicked. An empty script gives no feedback. The label must be part of the sprite's costume so users can see it on the stage. Labels and colour changes are feedback that help users know what is clickable and what happened.

Common mistakes: The last block should set the colour effect back to 0. If it sets 50 again, the button stays changed and never returns to normal. A sprite only works like a button if its script starts with 'when this sprite clicked'. The green flag block starts the script when the flag is clicked, not the sprite.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 61–74) and word search (Modules 41–74).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which block makes a sprite work like a button that starts a script when the user clicks it?
when this sprite clickedwhen green flag clicked
Matches
when green flag clicked say [Play!] for (2) seconds
↓
The green flag event starts the script when the project begins, not when the user clicks the sprite, so the sprite does not work as a button. Use 'when this sprite clicked' instead.
Applying
Meanings
Term
when this sprite clicked
Meaning
An event block that starts its script when the user clicks that sprite, so the sprite works like a button. Add a label to the sprite and a colour change to show it can be clicked.
Practice
when this sprite clicked
Testing
Gaps
Check Answer
Spots
3wait 0.5 seconds
4set color effect to 50

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Coelacanth' badge — Living Fossil, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which block makes a sprite work like a button that starts a script when the user clicks it?
A. when this sprite clicked ✓
B. when green flag clicked
'when this sprite clicked' waits for a click on that sprite. 'when green flag clicked' starts the whole project instead.
2. Mia draws a sprite that looks like a green circle. She wants it to be a Start button. What should she add so users know what it does?
A. A second green circle with no words
B. A label on the sprite that says Start ✓
A label on the sprite tells the user what the button will do when they click it.
3. True or false: A sprite with a 'when this sprite clicked' script will run its blocks when you click the BACKGROUND, not the sprite.
A. False ✓
B. True
The script only runs when the user clicks that exact sprite, not the background or other sprites.
4. Which script gives the user feedback that the button was clicked?
A. when this sprite clicked → (no blocks under it)
B. when this sprite clicked → change color effect by 25 ✓
A colour change shows the user the button has been clicked. An empty script gives no feedback.
5. Jay wants a button that says 'Play'. Which is the best way to make the label?
A. Type the word Play in the sprite's costume ✓
B. Type the word Play in the code area only
The label must be part of the sprite's costume so users can see it on the stage.

Match the Pairs

when this sprite clicked → An event block that starts its script when the user clicks that sprite, so the sprite works like a button.
change [color v] effect by 25 → A looks block that changes the sprite's colour, which can show the user that the button was clicked or can be clicked.
Put a label on a button sprite so users know what it does, such as the word Start. → say [Start] for (2) seconds
Make a sprite work as a button by starting its script with a click event. → when this sprite clicked switch backdrop to [game v]
when green flag clicked say [Play!] for (2) seconds → The green flag event starts the script when the project begins, not when the user clicks the sprite, so the sprite does not work as a button. Use 'when this sprite clicked' instead.
change [color v] effect by 25 when this sprite clicked → The event block is at the bottom. A hat block must be at the top of the script, so the colour change will never run when the sprite is clicked.

Key Term

when this sprite clicked
An event block that starts its script when the user clicks that sprite, so the sprite works like a button. Add a label to the sprite and a colour change to show it can be clicked.

Fill in the Blanks

1. when this sprite clicked say "Play!" for 2 seconds
Hint: Type the event block that starts the script when the user clicks the sprite, so it works like a button.
2. when this sprite clicked change color effect by 25
Hint: Type the name of the effect that changes how the sprite looks, giving click feedback.
3. when this sprite clicked say "Play!" for 2 seconds
Hint: Type the number that sets how long the sprite's label message shows.
4. forever if <touching mouse-pointer?> then set color effect to 50
Hint: Type the sensing word that checks whether the mouse is over the sprite, for hover feedback.
5. when this sprite clicked say "Go!" for 1 seconds
Hint: Type the two words that say which sprite must be clicked to start the script.

Spot the Error

Question 1
A when this sprite clicked
B set color effect to 50
C wait 0.5 seconds
D set color effect to 50
Line D — The last block should set the colour effect back to 0. If it sets 50 again, the button stays changed and never returns to normal.
Question 2
A when green flag clicked
B say "Hello!" for 2 seconds
C change color effect by 25
Line A — A sprite only works like a button if its script starts with 'when this sprite clicked'. The green flag block starts the script when the flag is clicked, not the sprite.
Question 3
A when this sprite clicked
B set color effect to 50
C switch backdrop to Game
D show
Line D — A start button should hide once the game screen appears. 'show' would leave the button on the screen when it is no longer needed. It should be 'hide'.
Question 4
A when this sprite clicked
B switch backdrop to pressed
C wait 0.3 seconds
D switch costume to normal
Line B — The button is a sprite, so its look changes with 'switch costume'. 'switch backdrop' changes the stage background, not the button.
Question 5
A when green flag clicked
B go to x: 0 y: 0
C say ""
D when this sprite clicked
E change color effect by 25
Line C — The say block gives the button its label. An empty message shows no label, so the user cannot tell it is a button. It should say "Click me!".

Student with a class code? Join your class →