Fox Studios logo Fox StudiosGame projects, devlogs and Scratch builds
Tutorials

Adding a Score and High Score to Your Scratch Game

A score is the smallest change that makes a Scratch game feel like a game. The moment a number climbs when the player does something right, the project stops being a demo and becomes something people want to beat.

A Scratch game showing a live score counter and a high score banner

A score is the smallest change that makes a Scratch game feel like a game. The moment a number climbs when the player does something right, the project stops being a demo and becomes something people want to beat. In Scratch this is built on variables, which are just labelled boxes that hold a number. Getting score working is easy. Getting a high score that survives between plays and shows up correctly takes a few more blocks and one common gotcha most beginners hit. This walkthrough adds both to a game you already have, in the order that keeps the logic clear and the bugs few.

Create a score variable and show it

Open the variables section and make a new variable called score. Decide whether it should be for all sprites or for this sprite only, and for a single score counter choose for all sprites so every part of your game can read it. Check the box next to the variable so it appears on the stage. Drag it to a tidy corner. Right now it shows zero and does nothing, which is exactly the right starting point. You have given the game a place to keep the number before you have written a single rule about when it changes, and that order keeps the next steps simple.

Reset the score when the game starts

A classic beginner bug is a score that keeps climbing across replays because it was never reset. Fix it before it happens. At the top of your main script, right after the green flag, add a set score to zero block. Now every fresh start begins at zero no matter what happened last round. This single block prevents the most confusing early problem, where a player finishes with a score that makes no sense because it quietly carried over. Reset first, then let the game add points, and the number always tells the truth.

Add points when something good happens

Find the moment in your game that deserves reward: collecting a coin, dodging an enemy, clearing a level. At that exact point in the script, add a change score by one block. For bigger rewards, change it by a larger number. The key is placing the block precisely where the good event is detected, not scattered loosely, or the score will climb at odd times. Test it immediately by playing and watching the number. If it jumps when it should not, you have placed the block inside a loop that runs every frame rather than once per event, which is the second most common early mistake.

Make a high score variable

Create a second variable called high score, again for all sprites. This one is different in a crucial way: you do not reset it when the game starts. It is meant to remember the best result across many plays, so it must survive a new round. Show it on the stage near the score so players can see the target they are chasing. Leaving high score untouched by the green flag reset is the whole point, and mixing it up with the score reset is what breaks most first attempts at a saved best.

Compare and update at game over

The high score logic lives at the moment the game ends. When the player loses or finishes, add an if block that checks whether score is greater than high score. If it is, set high score to equal score. Place this check at game over and nowhere else, because comparing constantly during play wastes effort and can cause flicker. Done right, the high score only ever rises, and only when a run genuinely beats the previous best. Players immediately understand the feedback: a new banner means they did better than ever before.

Understand what Scratch does and does not save

Here is the honest limit. A plain Scratch variable resets to zero when the project is reloaded from scratch, so a high score survives replays within one session but not a full reload for other players. To keep a high score across everyone and every visit you need cloud variables, which Scratch offers to logged in users and which store whole numbers on its servers. Cloud variables have rules: numbers only, and a short delay. For a classroom or personal project, a session high score is usually enough. Reach for cloud variables only when you genuinely want a shared leaderboard, because they add complexity you may not need.

Polish the display so it reads at a glance

Numbers alone work, but a little presentation makes the score feel earned. Use the large readout style for the variable rather than the slider or default box, so it looks like a game score and not a debug value. Position score and high score where they will not cover the action. If you are feeling ambitious, hide both during the title screen and show them only when play begins, using show and hide variable blocks. These touches cost minutes and make the project look finished, which matters more to how players judge it than almost anything under the hood.

Frequently asked questions

Why does my score keep going up forever? The change score block is almost certainly inside a forever loop or a tight repeat that runs every frame, so it fires constantly instead of once per event. Move it to the exact spot where the good event is detected, such as inside the touching coin check, not the loop around it.

Why does my high score reset every time I play? You probably added a set high score to zero block under the green flag by habit. Remove it. Only the regular score resets at the start. The high score must be left alone so it can remember the best result across rounds.

Do I need cloud variables for a high score? Only if you want the high score shared across all players and saved between full reloads. For a best result within a single play session, ordinary variables are enough and far simpler. Add cloud variables later if you decide you want a real leaderboard.

A number that makes people replay

Score and high score are small blocks with a big effect on how a Scratch game feels. Reset the score, add points at the right event, leave the high score alone until game over, and know the limits of what Scratch saves. Get those right and your project gains the one thing that keeps players coming back: a reason to try again.

RD
Reyansh Dole

Reyansh started making small games as a teenager and now writes the devlogs and tutorials here, focused on how beginners actually ship a first project.

More posts by Reyansh

More in Tutorials

constellation pattern for Fixing Bugs Without Losing Your Mind Tutorials

Fixing Bugs Without Losing Your Mind

Bugs are an unavoidable part of making games, and for beginners they can be deeply frustrating, sometimes frustrating enough to...

Reyansh DoleJul 17, 20264 min read
01doorganico 084goad 3hot8 4465456 after5internprogram ahandfulofblessings ahmadpc ahomcybersecurity allodialresources annodex antiquesandperiodcollectibles aotc asianworldkashmir beedlectrics bloggertemplatefree bluefeatheragency bodyweightsolution campaign08blog carfixadvisor catstreetcollective cbstvsports cnfanspurchasing committeeof500yearsofdignityandresistance covertopsdjs cs-kaiyuangame cuestacomunicaciontotal cxoutlet dancebetgame deskgearhub destinyvillastay detectmagazine di33 diamondsteelbuildings donmo dyanadropship emarsysfinance emimattl escapechan eskitarih evautoplay everythingweddings-orlando farmzone feedviewerapp gamevui123 gleasongrade greetingsday hacklabasu haskell iw-kaiyun jagoanproperti jilidskripsi joltbusinessfinance juegodepokergratis juegospucca kaeru-festival latestmehndidesigns lestanzediottaviano litemagazines localcommunityhero lustrsazan mariashebets menswheels newwebstechs1 nikkit ootheday oxigenvpn plurfitness prefetial probudgetcarpetcleaning psychicmrsmartin pyaten qvantor rejoignezlogis rexzbot riselayouts ruchin rwxqsgd5 sakaltime shibiaowang shop-bot skrtips strcoding tetapatrium topselller uneplanteartificielle vipertechcr webtech1223411 wo-kygaming yamaha-mekar yeknava yoybuysheets zenunwa yamaha-mekar jilidskripsi ankertoto ankertoto ankertoto ankertoto