NEW Explore the Scratch Block Dictionary, tutorials, textbook, and classroom guides

Start learning →

key (space) pressed? — Scratch Block Guide

📌 What you will learn

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.

Example using key (space) pressed?
  1. When green flag clicked
  2. Forever
  3. If key (up arrow) pressed? then
  4. 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.

Back to Sensing Blocks See the overview and patterns for Sensing Blocks. Learn more → Scratch Block Dictionary (All Categories) Browse Motion, Looks, Sound, Events, Control, Sensing, Operators, Variables, and Extensions. Learn more →

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.