Revision as of 15:05, 14 April 2021 by TemplatesFTW (talk | contribs) (Automated edit: fixed 2 style guidelines)

The general shape of a Hat block

A Hat Block is a block that starts a script when a specific event occurs. All hat blocks are either Control blocks, Events blocks, or More Blocks. In the Experimental Viewer, the first word of their name is capitalised.

Hat blocks are useful in Event Based Programming.


As Hat blocks are designed to start a script, they are shaped so no blocks can go on top of them — this is done by rounding the blocks' top. The bottom of Hat blocks are the same as Stack Blocks.

when gf clicked //This is a hat block.
go to (mouse-pointer v)


There are fourteen Hat blocks in Scratch. Four are used for extensions. One is made with every instance of a custom block. They are:

when gf clicked
when [ v] key pressed
when this sprite clicked
when I receive [ v]
when backdrop switches to [ v]
when I start as a clone
when [ v] > ()
when <> is true :: hat events
The When () Is True block

A wanted hat block is When () Is True.[1] It was available in the November 2006 beta but was removed in Scratch 1.0. It is available in some Scratch Modifications. This block can be reproduced by doing the following:

when gf clicked
wait until <... :: grey>
broadcast [true v]
wait until <not <... :: grey>>

when I receive [true v]


when gf clicked
if <... :: grey> then

The latter is equivalent to the replacement in Scratch 1.0.


Without Hat blocks, scripts could only be activated manually by clicking them, and not at all online. Each Hat block has a different method for getting activated — this is so different scripts can be started at different times. There are four different ways to activate a script — when the Green Flag is clicked, a key is pressed, the sprite is clicked, when a broadcast is received.

An example for when the When I Receive () block can be used as follows:

when I receive [Next Level v]
next costume

Snap! Hat Blocks

In the Scratch Modification Snap!, hat blocks are used in definitions of Custom Blocks (procedures). These hat blocks contain an image of the block on them. The custom block carries out the script attached to the bottom of the hat block.

Hat blocks cannot be created in BYOB/Snap! 4.0, but may be available in BYOB/Snap! 4.1.

Cat Blocks

SandCastleIcon.png This section has links to websites or programs not trusted by Scratch or hosted by Wikipedia. Remember to stay safe while using the internet, as we cannot guarantee the safety of other websites.
The cat blocks that replaced the hat blocks in the editor

For April Fools Day 2020, all hat blocks were replaced with 'Cat Blocks', where a cat drawing was put on top of them. Rolling the mouse over a cat block would cause it to blink, and mousing over its ear would cause the ear to move.

There were several protests to bring them back,[2][3] but it was officially rejected by the Scratch Team.[4] However, they can still be accessed here.


Cookies help us deliver our services. By using our services, you agree to our use of cookies.