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

Start learning →

username — Scratch Block Guide

📌 What you will learn

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.

Example using username
  1. When green flag clicked
  2. If (username) = () then
  3. Say Welcome, Guest! for 2 seconds
  4. Else
  5. 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.

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