When I Receive ()
when I receive [message1 v]
Category Event
Type Hat
Introduced in 14Feb04

The when I receive () block is a hat block and an Events block. The block activates its script when the specified broadcast has been sent by a calling script.

If the same message is sent again while the script is still running, the script will restart without reaching the blocks at the end. Using the Broadcast () and Wait block can help to make a message script run over and over again.


When a Broadcast message is sent throughout the project, all of these blocks set to receive it will activate.

Note Note: If the sprite the block is in has clones, the code under it will run for both the sprite and all of its clones

Example Uses

Broadcasts are used to invoke scripts when certain evaluations are met; for scripts to activate once the broadcast is sent, those scripts must wear the When I Receive () block. When a sprite activates a script from receiving a broadcast, its current clones will also receive the broadcast and activate the same script individually. Some common uses are:

when I receive [Failure v]
wait (3) seconds
change [color v] effect by (25)
stop [all v]
  • Hiding select sprites when a certain condition is met under a particular evaluation
when I receive [broadcast v]
  • When a scene must be set
when I receive [next background v]
next costume
  • Effective communication with scripts or sprites
when green flag clicked
say [Hi!] for (1) seconds
broadcast (communicate v)
when I receive [communicate v]
say [Hi!] for (1) seconds
when I receive [run v]
. . .
broadcast (run v)
  • Winning a game
when I receive [win v]
say [You win!] for (2) seconds

See Also

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