when (space) key pressed — Scratch Block Guide
Triggers whenever the chosen keyboard key is pressed, even if the green flag was not clicked.
What this block does
Triggers whenever the chosen keyboard key is pressed, even if the green flag was not clicked.
Good for single-tap actions like flipping slides, playing notes, or toggling a menu.
- Category: Events Blocks
- Key tip: For smooth walking in games, use "forever + if <key pressed?>" instead—it has no OS key-repeat delay.
Working Scratch example
Try building this small script in the Scratch editor, predict what will happen, then click the green flag to test it.
- When space key pressed
- Start sound Pop
- Next costume
Try it: Each tap of space plays a pop and switches costume.
Related block guides
Explore other blocks in the same category or return to the full English Block Dictionary.
FAQ
When should I use "when (space) key pressed" in Scratch?
Good for single-tap actions like flipping slides, playing notes, or toggling a menu. For smooth walking in games, use "forever + if <key pressed?>" instead—it has no OS key-repeat delay.
This guide is provided for educational purposes. Scratch screens and terms may change over time, so please check the official Scratch website as well.