From Test-Scratch-Wiki

Archive.png This article or section documents a feature not included in the current version of Scratch (3.0). It is only useful from a historical perspective. For information on the feature that replaced this one, see Username (block).
User ID
2.0 User ID.png
Category Sensing
Type Reporter
Introduced in 2.0 alpha
Removed in 2.0 beta

The User ID block was a Sensing block and a reporter block. It reported an ID unique to each user that viewed a project this block is in.


Each user had a different ID according to when they viewed the project (the first viewer was 1, the second was 2, and so forth). Users who were not logged in to an account were assigned the user ID 0. User ID's remained constant for the same project. The user ID block itself was a reporter block, and belonged to the Sensing category.


Main article: List of Block Workarounds

Some Scratchers have requested for this block to come back.[1] However, a user did find a workaround for this block.[2] Here's a simple workaround for this block:

when gf clicked
if <not <[☁ users v] contains (username)>> then
 add (username) to [☁ users v]
repeat until <(item (check user id) of [☁ users v]) = (username)>
 change [check user id v] by (1)

then use

say (join [Your User ID is ] (check user id))


if <(check user id) = [insert User ID number you want here]>
 . . .

depending on what you want to make.

Note Note: This will not work until cloud lists are added.

Example Uses

This block could be used in some of the following ways:

  • A personal high score
replace item (user id) of [☁ highscores v] with (score)
  • Preventing users from voting twice in a survey
if <[☁ voters v] contains (user id)>
say [Sorry, you already voted!]
  • Keeping user-specific data
    • Only one user controls a sprite using same keys
when [up arrow v] key pressed
if <(user id)=(item (#) of [players v])>
 move (1) steps
  • Changing your score and not another's score (scripts above)

Uses for Saving Games

The user ID block could also work with the cloud data to save a game for someone. One possible way is to have a list of levels in a game. While the project is being played, each time you reach a level it adds the level onto the list in the item of your user ID. Then, next time you play the game, it can take the item of your user ID from the list and start you with that level. This script displays the scenario.

when I receive [new level v]
replace item (user id) of [☁ stored levels v] with (level)

The broadcast is used to show that a new level is being started. This next script could also go in the game.

when gf clicked
set [level v] to (item (user id) of [☁ stored levels v])
switch backdrop to (item (user id) of [☁ stored levels v])

Change to Username Block

During the Scratch 2.0 Beta, in early April 2013, the Scratch Team changed the user id block to the username block, which gives an output of the user's username. This way with high score lists it's easier to detect who set the high score. Now, since it was deleted from Scratch, it is obsolete, so it looks red. If you click it, then all it will say now is NULL instead of a number.

See Also


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