Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

arrow_back Vote on the Talent Show (Advanced)


You may have seen talent shows that allow people to vote on a winner. This screencast will show you how to allow users to vote for a winner in your talent show.

Users will vote for a winner by clicking on a button sprite. This example uses the checkmark, but you can use any button sprite you like. When people click on the button, it will instruct the computer to cast a vote for a sprite. To make that happen, use the “when this sprite is clicked” event. Now, the program needs to keep track of how many votes each sprite receives. In computer science, an element that keeps track of things, such as a score or number of votes, is called a “variable.”

To make a variable in Scratch, click on the data menu, then choose “make a variable.”

You need to name your variable, and it makes sense to name it something that tells what it does--this can make it easier for other people to understand your code if you work together on a project. In this example, the variable keeps track of how many votes the dog gets, so it’s named “dog votes.” Choose a name for your variable that makes sense for your project. Every time the sprite is clicked, the sprite’s vote count should go up by one. To make that happen, put the “change by“ block under the “when this sprite is clicked” block. In this case the block is set to “dog votes,” but yours will be set to the variable you made.

To see what the variable is holding, click the checkmark next to it. Then, the variable and the number it contains will show up in your project!

Test your code. When you click on the checkmark, the sprite’s votes should go up.

Great! Do the same for all the other sprites in your talent show. Now, it’s your turn. Add sprites that work as buttons the user can use to vote for a talent show participant. Create a variable for votes for each sprite.

Choose an Add-On
Bust a Move
Learn how to earn the "Bust a Move" badge.
Energy Burst
Learn how to earn the "Energy Burst" badge.
Multiple Musicians
Learn how to earn the "Multiple Musicians" badge.
Clone Crazy
Learn how to earn the "Clone Crazy" badge.
Music Promoter
Learn how to earn the "Music Promoter" badge.
Vote on the Talent Show (Advanced)
Modify your project so you can vote for a talent show contestant.
Win the Show! (Advanced)
Make the winning performer celebrate their victory!
arrow_backward Back
Next arrow_forward
  1. See the talent show characters you can build.
  2. Find out what badges you can earn.