02Home & Garden · Updated
Scratch Cloud Variables: How They Work and What They Do
Short answer
Cloud variables store shared project data online
Scratch cloud variables are number-based variables whose values are saved on Scratch’s servers and shared across sessions. They let projects carry simple data, such as a high score, between players, but they are not a general-purpose database or a reliable real-time messaging system.
What a cloud variable is
A Scratch variable is a named container for a value that a project can use while it runs. An ordinary variable belongs to the current project session: it can hold a score or other value, but that value generally does not become shared online just because the variable exists.
A cloud variable is a special kind of Scratch variable marked for online storage. When a project changes its value, Scratch can save the update to its cloud service. Other users running that project can then receive the shared value. In practice, this makes a cloud variable useful for information that should persist beyond one player’s session or be visible to more than one player.
Cloud values are numeric. They can represent a score, a counter, or a number-coded state. They do not directly store words, pictures, lists, or arbitrary files. For example, a project might save a best score as 1250, but it cannot use a cloud variable as a text box containing a player’s name.
How cloud variables work in a project
To use one, create a variable in the project’s Variables category and enable its cloud-variable option if that option is available to your account and project. The variable is typically shown with a cloud symbol in the editor. The exact controls can differ slightly by Scratch version or interface changes.
Once created, a cloud variable is used in blocks much like other variables: a script can set it, change it, or check its value. The important difference is that its value is synchronized through Scratch rather than existing only inside one running copy of the project.
- Set a value: A scorekeeping project can set a cloud variable to a player’s current score when a round ends.
- Update a value: A shared counter can change when a project event occurs, provided the scripts are designed to handle simultaneous changes sensibly.
- Read a value: A project can display the stored number or compare it with a new result to decide whether a record has been beaten.
Cloud updates travel over the network, so they are not necessarily instantaneous. A player may briefly see an older value while Scratch synchronizes changes. A project should not depend on every update arriving at an exact moment, particularly for fast gameplay.
What cloud variables are good for
The most familiar use is a high-score board. A project can save a record score online, so a later session can show that value instead of starting with a blank record. Cloud variables also suit simple shared totals, such as a counter that increases as users complete an activity, or a small numeric status that multiple copies of a project need to read.
They work best when the stored information is compact, numeric, and not sensitive. A cloud variable is not a private account profile, and a project creator should not treat it as a secure place to keep information. Scratch projects are interactive, and users may be able to affect how a project runs or what it submits.
Cloud variables also do not automatically create a complete multiplayer game. A shared number can coordinate a basic state, but a real-time game may need to track several players, their positions, timing, and actions. A single numeric value cannot conveniently represent all of that, and network delays or simultaneous updates can cause conflicts. Scratch’s cloud features have limits intended to keep the service manageable and safer, so they should not be assumed to support unlimited traffic or data.
Who can use them and why they may be unavailable
Cloud-variable access depends on Scratch’s current account and project rules. Scratch has historically restricted cloud features for accounts that have not completed its account-confirmation process, and some account types or project contexts may not offer the feature. Availability and exact requirements can change, so check Scratch’s own help materials if the cloud option is missing.
Projects also need to be shared appropriately for other people to run and interact with them. Being able to create a cloud variable does not mean every project visitor can write any value without restrictions. Scratch applies platform rules and limits to cloud activity, and those safeguards can affect how a project behaves.
Common problems and misconceptions
- The option is missing: Confirm that you are signed in, check whether your account has access to cloud features, and make sure you are editing a project in a context that supports them. The editor’s layout may differ by version.
- The value resets: Check that the project is changing the cloud variable rather than an ordinary variable with a similar name. Also consider whether another script or user is setting it to a different value.
- Updates arrive late: A cloud value depends on network communication. Test the project with realistic expectations instead of treating synchronization as instantaneous.
- Two users overwrite each other: If multiple project copies update the same variable, the last update received may replace an earlier one. Design shared counters carefully; a simple read-then-add sequence can lose an update when two players act at nearly the same time.
- Text will not save: Cloud variables hold numbers, not direct text. Encoding text as digits is complicated, limited, and not a reason to store personal information.
A common misconception is that a cloud variable saves a whole project or every player’s personal progress. It stores a shared numeric value, not a full save file. If a project needs separate records for many users, cloud variables alone may not provide the structure or privacy the creator expects.
Using cloud data thoughtfully
Keep cloud data simple and explain in the project what it represents. Use clear variable names, decide which scripts are allowed to update the value, and avoid making critical gameplay depend on a cloud response arriving immediately. When several players can change the same value, test cases where they do so close together.
Do not put real names, contact details, passwords, or other personal information in cloud variables. They are not designed as a secure storage system, and Scratch’s community guidelines apply to projects and interactions. If the cloud feature is not available or is unnecessary, an ordinary variable is often a better choice for a score that only matters during one session.
Frequently Asked Questions
Do Scratch cloud variables save between sessions?
Yes, their purpose is to keep a numeric value on Scratch’s cloud service so it can be available in later sessions. The project still needs to read and use the value correctly, and access or synchronization can be affected by platform rules and connectivity.
Can a Scratch cloud variable store text?
No. Cloud variables store numbers. A project can sometimes represent simple information with numbers, but they are not a direct way to save words, usernames, or messages.
Why can’t I create a cloud variable in Scratch?
Cloud access may depend on your account status, the project context, and Scratch’s current rules. Sign in, check the account-confirmation requirements and Scratch help pages, and remember that editor controls can change slightly between versions.
Can two players use cloud variables at the same time?
They can share and update cloud data, but synchronization is not guaranteed to be instantaneous, and simultaneous writes can overwrite one another. Cloud variables can support simple shared features, but they do not by themselves provide a full multiplayer networking system.
Are Scratch cloud variables private?
Do not treat them as private or secure storage. They are intended for simple project data, so never store personal information, passwords, or anything that should remain confidential.
Related
- Airplane Carburetor: How It Mixes Fuel and Air
- How to Read a DD214: A Field-by-Field Guide
- How to Cook Japanese Sweet Potato for a Creamy Center
Further reading: Scratch. Details can change, so check the official page for anything that matters to you. Spotted a mistake? Tell us. How we write an answer.