key (space) pressed? — Scratch Block Guide
Boolean block that is true for the entire time the chosen key is held down.
What this block does
Boolean block that is true for the entire time the chosen key is held down.
Pair with "forever" and "if" for responsive, lag-free game movement.
- Category: Sensing Blocks
- Key tip: You can even detect diagonal movement by checking left/right and up/down in separate "if" blocks.
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 green flag clicked
- Forever
- If key (up arrow) pressed? then
- Change y by 5
Try it: Moves smoothly upward while the Up arrow is held.
Related block guides
Explore other blocks in the same category or return to the full English Block Dictionary.
FAQ
When should I use "key (space) pressed?" in Scratch?
Pair with "forever" and "if" for responsive, lag-free game movement. You can even detect diagonal movement by checking left/right and up/down in separate "if" blocks.
This guide is provided for educational purposes. Scratch screens and terms may change over time, so please check the official Scratch website as well.