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

Start learning →

when (space) key pressed — Scratch Block Guide

📌 What you will learn

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.

Example using when (space) key pressed
  1. When space key pressed
  2. Start sound Pop
  3. 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.

Back to Events Blocks See the overview and patterns for Events 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 "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.