Jump to main content

Scratch User Guide: Help, I'm Stuck! Troubleshooting a Program in Scratch

Log In

This feature requires that you be logged in as a Google Classroom teacher and that you have an active class in Google Classroom.

If you are a Google Classroom teacher, please log in now.

For additional information about using Science Buddies with Google Classroom, see our FAQ.

Part of learning Scratch is figuring out how to make scripts (sets of instruction blocks snapped together) that make the sprites do what you want them to do. In the beginning, this might take some trial and error. It is completely normal for a program to not run perfectly the first time! Keep trying and experimenting—you might be surprised at how skilled you become at working out solutions. Below are some tips for how to get your Scratch program working the way you want. Remember, be patient and don't give up!

Figuring Out Where the Problem Is

The simple truth is, you can't "fix" a problem until you know "what" and "where" the problem is. If you've created a script and it doesn't perform the way you expected, you might have forgotten to put in some blocks or used the wrong blocks. You can try one or more of the methods below to figure out what part of your script isn't working the way you anticipated.

  1. Method 1: If your script doesn't perform the way you expected, you can diagnose where the problem is by stepping through the project. (Note: this feature is no longer available in Scratch 3.)
    1. Under the "Edit" category, click on "Start Single Stepping." Now when you run your program, each block will be highlighted as the computer performs that instruction.
    2. If you want to slow down how fast the blocks (instructions) are being executed, you can also choose "Set Single Stepping" and select "Flash blocks (slow)" from the Edit category. This will slow down the action (it's kind of like watching something in slow motion), so that you can better see what is happening in each part of the code and correct any problems.
    3. Even with slow single-stepping, it might be difficult at times to know "where you are at" and whether or not different scripts are being activated as you intended. To help keep track of this, you can add blocks to your scripts, like a "Say" block that says "hello" or "starting xyz script now," that can give you feedback about when a script is functioning.
  2. Method 2: If you had a script, or set of scripts, that were working, but stopped working after you added some additional blocks, you know that the problem lies somewhere in the new additions you made.
    1. If you've saved an earlier version of your program (which is always a good idea!), you can go back to that and re-evaluate your changes.
    2. If you don't have a saved working version, you can start breaking apart your script.
      • Break each script into smaller pieces and make sure they work as you expect.
      • When you find a piece that doesn't do what you expected, you've figured out where the problem is and can start trying other solutions.
  3. Method 3: If you are using variables in your script (symbols that can take on different values), it can be helpful to know what the values of these variables are as your script executes.
    1. Under the Variables category, there are checkboxes that you can check to show the values of different variables on the stage.
    2. You can also use the "Say" block under the Looks category to "say" the value of the variable.

Finding the Solution to the Problem

Once you've figured out where your problem is, it might be obvious to you what the solution is. If so, great! At other times, you might be left scratching your head. If that's the case, it might be time to step away from the computer for a moment and grab a pencil and pad of paper. Write down what you want each of your scripts to do. Think about the kinds of blocks you'd need to execute the task. Once you have the theory straight in your head, go back and look at your program again. Did you miss something the first time?

  1. If you're still stuck and need help figuring out the solution, or are just looking for some inspiration for your next programming project, there are a lot of places to turn. Table 1 lists a variety of resources.

Type of Resource Citation
Official Scratch getting started resources https://scratch.mit.edu/ideas
Scratch wiki with more information about Scratch https://wiki.scratch.mit.edu/wiki/Scratch_Wiki_Home
Scratch forum where you can ask questions https://scratch.mit.edu/discuss/
Table 1. Resources with step-by-step help for learning to program with Scratch.
  1. Looking at other people's programs is a good way to learn how to do something in a programming language. You can look for programs that do the things you want yours to do. Once you find a good example program, look at the program's scripts and see what blocks were used, and in what order. Try to adapt the solution to your project. It might help to look at several programs by different people to see how different people tackle the same problem. You can also view, copy, and edit projects made by other Scratch programmers at MIT's Scratch homepage.
  2. Other programmers can also be a great resource. Try asking friends or family members who have programming experience for tips and advice, or log on to the MIT scratch forums and post a question. Make sure to point out what version of Scratch you are using.
    1. Important Note: Your personal data is extremely valuable, particularly on the Internet, and can be used against you if someone else gets a hold of it. Keep it protected. Never give your real name, address, phone number, the name of your school, or a picture of yourself to anyone online. Email addresses, user account names, and screen names should not be your real name, the name of your school, or some combination of the two.

Science Buddies Scratch Resources

Top
Free science fair projects.