username — Scratch Block Guide
Returns the signed-in Scratcher’s username, or an empty string if playing signed out.
What this block does
Returns the signed-in Scratcher’s username, or an empty string if playing signed out.
Personalize welcome screens or display who holds a high score.
- Category: Sensing Blocks
- Key tip: Always handle the empty-string case for visitors who are not logged in.
Working Scratch example
Try building this small script in the Scratch editor, predict what will happen, then click the green flag to test it.
- When green flag clicked
- If (username) = () then
- Say Welcome, Guest! for 2 seconds
- Else
- Say (join Welcome, username) for 2 seconds
Try it: Greets signed-in users by username and guests politely.
Related block guides
Explore other blocks in the same category or return to the full English Block Dictionary.
FAQ
When should I use "username" in Scratch?
Personalize welcome screens or display who holds a high score. Always handle the empty-string case for visitors who are not logged in.
This guide is provided for educational purposes. Scratch screens and terms may change over time, so please check the official Scratch website as well.