Debugging in Roblox Studio - AP CSP Roblox — Transcript
Full transcript
- 0:00hi in this lesson we'll talk about best
- 0:03practices for finding and fixing bugs in
- 0:05your programs
- 0:07debugging is a process we use to fix
- 0:09bugs or problems that find their way
- 0:12into our programs as we develop them
- 0:15debugging can be similar to reading an
- 0:18iSpy book you're looking for something
- 0:20small something that isn't quite right
- 0:22in a big program it takes some patience
- 0:25and focus
- 0:28so what do we learn about debugging you
- 0:31might think that you can simply avoid
- 0:33bugs by writing good code
- 0:35there are things that you can do to try
- 0:37to avoid errors like keeping your code
- 0:39neat and organized but the truth is
- 0:41everyone even experienced programmers
- 0:44write bugs
- 0:45because of this debugging is really the
- 0:48most important skill that programmers
- 0:50learn
- 0:51there are different types of errors that
- 0:53can occur in a program
- 0:55syntax are the rules for how to write
- 0:57code the syntax can differ for different
- 1:00programming languages
- 1:02if there is an error in the syntax the
- 1:05program won't run properly or may not
- 1:07run at all
- 1:08a logic error is an error in the code
- 1:10that doesn't keep the program from
- 1:12running but it doesn't do what it's
- 1:14supposed to do these are usually harder
- 1:16to find and fix when compared to syntax
- 1:18errors
- 1:21when a runtime error occurs the program
- 1:23starts running but then crashes later on
- 1:26something that might cause a crash like
- 1:28this could be a player input that runs a
- 1:31function that then has an error
- 1:34let's take a closer look at syntax
- 1:36errors a syntax error is a mistake in
- 1:39how the code is written computers only
- 1:41understand commands if they're written
- 1:43with specific rules if the syntax is not
- 1:45exactly correct the code won't run there
- 1:48are a lot of ways this could happen the
- 1:50command on the screen is correct as
- 1:52written but let's look at a few common
- 1:54mistakes that could occur
- 1:56here we use the lowercase M instead of a
- 1:59capital M this gives us an error and the
- 2:02script won't run properly
- 2:05here we forgot the quotes around the
- 2:07string Rock and we get another error
- 2:11logic errors can be harder to spot the
- 2:14code on the screen will run with no
- 2:16errors but it may not run as intended by
- 2:19the programmer in this program there are
- 2:21two players and we want to print their
- 2:23combined scores but when we run this
- 2:26program the total score is printed as
- 2:2918. it should be 9 plus 5 which is 14.
- 2:33so what's going on where's the error
- 2:36foreign
- 2:37well it looks like we have player one
- 2:40score being added to itself instead of
- 2:43adding Player 1 and player 2 scores now
- 2:46let's fix this
- 2:48we change player one score to player 2
- 2:51score now when we run the program it
- 2:54prints 14 and runs as intended problem
- 2:56fixed
- 2:58there are several strategies that make
- 3:00it easier to debug a program keeping
- 3:02your code neat and organized can help a
- 3:05lot in finding a problem
- 3:07this includes adding informative
- 3:09comments using descriptive variable
- 3:11names and by using functions to avoid
- 3:14repetitive code
- 3:16most programs you develop will perform
- 3:18multiple actions you can use comments to
- 3:21section out your code and only run
- 3:23through it bit by bit this will help to
- 3:26isolate the problem which will make it
- 3:28much easier to fix
- 3:30to do this you can highlight the section
- 3:33of code that you want to comment out and
- 3:35hit shift and forward slash
- 3:38Roblox Studio includes a few debugging
- 3:41tools as well the output window is very
- 3:44helpful in debugging programs this
- 3:46window displays errors captured from
- 3:48running Scripts
- 3:50you can click right on the message to be
- 3:52taken to the mistake
- 3:54in this image it looks like we mistyped
- 3:56the word ladder well that's an easy fix
- 4:01you can also use the output window along
- 4:04with print statements to make sure your
- 4:06scripts and functions are set up
- 4:07correctly here a debug print statement
- 4:10is printed to the output when the
- 4:12function runs this way you know that
- 4:14it's running correctly
- 4:16print statements are great to add near
- 4:18lines of code that you're unclear of or
- 4:20to print the contents of a variable you
- 4:23might be having issues with
- 4:25Roblox studio also has a very useful
- 4:28debugging tool called Script analysis
- 4:31you can use this tool by choosing it
- 4:33from The View tab
- 4:34the script analysis window performs
- 4:37static analysis on your scripts and
- 4:39displays active errors and warnings this
- 4:42means that instead of having to run your
- 4:44program to see the errors you can
- 4:46instantly see any errors in the window
- 4:48while you're writing your code
- 4:51Can you spot the error here
- 4:53the script analysis message says that
- 4:56hello is an unknown variable this should
- 4:59actually be the name of the variable
- 5:01which is message
- 5:03there we go all fixed and we didn't even
- 5:06have to run the code to find this error
- 5:08here's a helpful summary that you can
- 5:10find in the slide deck or print out
- 5:12all right let's take what you've learned
- 5:14and put it into practice
About this transcript
This page contains the full transcript of Debugging in Roblox Studio - AP CSP Roblox by CodeHS, generated from the public captions YouTube serves with the video. The transcript has 854 words across 133 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.