scripting Archives - NEWSBLOX.net

How To Fix Scripting Errors In Roblox Studio – Debugging Tutorial

By | Scripting Tutorials | No Comments

How To Fix Scripting Errors In Roblox Studio

(if you don’t understand any of the words used in this article, a glossary is at the bottom)

I always get asked the same question when I’m teaching people how to learn to script on ROBLOX: “Hey Alvin, why doesn’t my script work?”. It’s hard for me to answer every one of these questions because as simple as they seem they always require time to figure out what’s wrong, but today I’m going to show you how to fix it yourself. This process is called “Debugging” – It means to simply identify and remove errors from computer code.

Firstly, what we have to remember is that when we’re programming (also known as scripting, same thing) we’re basically telling a computer what to do. Take this as an example: If we look at the hit shooter game Phantom Forces, you’d expect that the script thinks we’re in a fast-paced shooter game and that the aim is to shoot the enemy team. However, that’s wrong as scripts on ROBLOX and in the everyday programming world do not understand the English language. The script doesn’t know that this is an FPS, a war between two sides. What the script thinks, is that when you press down your mouse button, it’s going to create some bullet parts and make them fly off in the direction you clicked in. Then, if the part touches another player, it will do a check to see if they are on the correct team. If so, they are going to lose some of their health. As you can see here, this shows that the script is being told to look out for these things, it’s not actually thinking somebody’s been shot, or someone has a gun in their hand. The script is being told what to do and is doing as it’s told.

However, sometimes as humans, we can write our computer code incorrectly. If you, a human being, saw two words such as pineappel and ‘pineapple’, you’d see that one of them was spelled incorrectly. A computer, though, would look at this and think that you’ve spelled the word correctly and will go along as it’s told. If you spelled something wrong in your computer code, the computer would become confused and would return something called an error. An error happens when the computer reaches something in your code where it does not know what to do. This is why it is very important for your code to be exactly 100% correct, because if you spell something wrong, make a typo or forget to add something, it would stop your script from working properly.

There are lots of types of errors and today we’re going to go over one of the most basic errors and what you can do to try and fix it. However, I can’t tell you how to fix every single one – every scripter gets puzzled at some! However, I’m going to show you how I usually fix my bugs:

  1. Pseudocode – Plan out your script in English. Instead of using the scripting language, write it all out on paper in English and make sure it makes sense. For example, instead of “if value == 12 then”, write “Is the value equal to the number twelve?”. Sounds silly but it’s really helpful!
  2. Ask for help – Sometimes your brain isn’t thinking properly and other people may be able to spot things in your code that you can’t, even the smallest of things! There are lots of places to go and ask for help at the bottom of this article.
  3. Make your code neat and indented – Make your code neat so it is readable. This will make it easier to spot issues in your code as well as easily finding out which line any of your errors were on.

So let’s take the most common type of error and try to fix it:

Syntax Errors

Now, here comes the juicy computer coding jargon which you’ve never heard of. Syntax means “the structure of statements in computer code” – Think of it like a dictionary for computers. When you run your code, the computer will read it and check what you’ve written in your code into a virtual dictionary to see what it all means. If you spell a word wrong in your code then the computer is going to try and look up what you misspelled in the dictionary and see that it’s not listed therefore the computer has no clue what it means. The computer will then start spewing out Syntax Errors in the Output box of Roblox Studio. If you’ve never seen the Output box before then it’s one of the most important things you’ll ever use during programming. Here’s what it looks like and also here’s how you find it:

This is the Output Window in ROBLOX Studio. In other programming languages, sometimes this may be called the Error Log.


To find the Output Window, you will need to click on View at the top of your ROBLOX Studio menu and then on Output.

Okay, so let’s take a look at some common Syntax Errors:

15:19:07.109 – RepicatedStorage is not a valid member of DataModel

15:19:07.112 – Script ‘Workspace.Script’, Line 1

Let’s just quickly analyse this error. Firstly, we have the timestamp of when the error occurred in a very precise measurement. Next, we have the description of the error and then on the next line, we have the name of the script the error occurred in and what line the error occurred on.

Now, if you have a look at this, it says that ‘RepicatedStorage is not a valid member of DataModel’. DataModel means the actual Game, the thing which has the Workspace inside it etc. You can see I spelled ReplicatedStorage incorrectly. The computer has looked for RepicatedStorage and hasn’t found it because there isn’t such thing called RepicatedStorage. If I change my code to the actual ReplicatedStorage, there will not be an error.

Secondly, the blue part in the Error tells us where the error occurred. Here is my Explorer and my script, we must head into Line 1 in the Script in the Workspace. My code should define ReplicatedStorage as a variable (A variable is used to store data in ROBLOX Studio, for example, we can change game.ReplicatedStorage into RepStorage to save time writing it all out).


This is my script which does not work. I have mis-spelt ReplicatedStorage.

This is my script which does not work. I have misspelled ReplicatedStorage.

Now, if we change the script so that the spelling error is corrected, the computer will know that we’re talking about the ReplicatedStorage and won’t error in the Output Window. And there we go, our error is fixed!

If you need more help fixing errors in your ROBLOX code, there are lots of places you can go for help. We recommend the following resources:

Roblox Scripters Forum


Roblox Wiki Error Page

Thank you for reading this article about how to fix some bugs in your code in ROBLOX Studio! I hope that it helped you 🙂


etc – Means et cetera – It is a Latin expression that means “and other things”, or “and so forth” in the English language.

code – Code is the language which we write in scripts for the computer to understand.

coding / programming / scripting – These words all mean the same thing. It means to write computer code.

syntax – Syntax is the words and numbers which a computer can understand. Think of it like a dictionary, with all of the syntax listed in the dictionary. Your spelling has to be correct else the syntax won’t be written properly.

ReplicatedStorage – A Service in the Game, like Workspace, where you can put scripts, models etc. Everything in here will be shown to the client (all players) and the Server.

errors / bugs – Means the same thing. It means something that stops your code from working that the computer cannot understand.

DataModel – The DataModel houses everything inside your game which you can see. You don’t have to touch anything to turn it on, it is always on. Every Service (ReplicatedStorage, Workspace, StarterGui etc) lives inside the DataModel. Also known as “game” in game.Workspace, game.ReplicatedService etc.