Published September 24, 2023 in Roblox Development Tutorials

What is Roblox Coding?


Written By:

Seal

Seal is a jaded programmer who has been scripting long past retirement age.

Roblox Coding

What is Roblox Coding?

Roblox is one of the largest online game platforms out there. And what's amazing? The games on it are made by the users! Many of us have played a bunch of great Roblox games, but you may be wanting to learn how to make your own. (Why else would you be reading this article?) 

In this article we're going to cover the hardest part of making a Roblox game. The coding. 

What is Coding?

Programming/Coding/Scripting can all be used interchangeably, they all relatively mean the same thing. Yes we can get into the technicalities and say there is a difference between a scripting language and a programming language, but if your wanting to learn how to make a Roblox game we won't really need to delve into that.

So, what is coding? Let's say we build a Roblox game. We create a cool menu, and make a map, levels, NPCs, and objects. When we hit the play button... nothing happens! The buttons on our menu don't work. The objects don't move, we can't talk to our NPCs, and our weapons don't work! Why? Because they are all lifeless models. Like drawing a picture. It's hard, and it takes time, but simply drawing a picture won't magically make it some to life. Making the models for a video game is only half the development process.

We now need to tell the computer, how to give life to our creations! By give life, I'm referring to creating a set of instructions for our computer to follow, that allow us to add functionality to our video game, almost as if we're "giving it life".

So, how do we do this? With scripting, scripting is writing a set of instructions for our computer, and in Roblox's case, the server, to follow. To do this, we need to talk to the computer.

Writing Our Games Instructions

To write instructions for our computer to follow, we need to be able to speak it's language. This is where the term "Programming Languages" comes from. Computers don't speak English, and frankly It would probably be harder if they did. 

Different video games use different programming languages. It all depends on the game engine you're using. Roblox Studio uses Luau (basically Lua 5.1). Luau is Roblox's version of Lua 5.1; If your interested in reading more about Luau, check out this article: What Coding Language Does Roblox Use?

We will need to write our instructions in Luau. So, what will these instructions look like? Well, one big thing we will need to remember is that computers can't think. So that means when we want to write instructions for it, the instructions will need to outline step-by-step what we want the computer to do.

That also means everything we type needs to be a command. For instance, let's say we want our game to display a message in the output window, we would type:

print("Hello World!")

We use a command, print(), then we provide the message in quotations for the console to display, "Hello World!"

This is writing one line of instructions. But this is just printing a message, how can we change things in our game? 

To do that, we need to get familiar with Roblox Studio.

Introduction to Roblox Coding

Before we dive into Roblox coding, let's get familiar with Roblox Studio.

So, you're on a fresh studio baseplate. It will probably look something like this:

Roblox Coding

We're going to need to open a few windows before we get started. Go to the top bar, and select "View". Then you're going to open the follow windows: Explorer, Properties, and Output.

Here's some details on what these windows do:

  1. Explorer. The explorer window will show us everything in our games scene. It contains all of the objects in our game. This includes the parts that are rendered on screen, the UI's, and our games music. Everything in the Workspace folder will be rendered on screen. That's where our models and parts go.
  2. Properties. The properties window will show all of the attributes of our parts. They contain their details like name, color, position, parent, etc. These properties are how were going to change things in our game.
  3. Output. The output is where our Luau code messages will appear. This is useful to have open while coding, as it can give us some much needed information.

Now that you have these windows open, we can start writing some more complex instructions for our game. Let's insert a part. To do that, select the insert button, on the "Home" tab:

Roblox Coding

Once you've selected that, a part will be inserted into the workspace. Let's now go to our explorer, and insert a Script into "ServerScriptService".

Roblox Coding

Select ServerScriptService, when your mouse is hovering over it, you will see a + next to ServerScriptService. Click the + and use the search box to select a Script.

This will give the following result:

Once you have done that, open the script in ServerScriptService. In the script window there will be the print command I wrote about earlier. You can delete the print command. Let's start with something simple. Let's do something with the part we just created. Let's change it's color. To do that we are going to need to path to the part. 

Pathing refers to showing the computer where an object is in the hierarchy, or explorer window.

Roblox Coding

To do that, we need to start at the top, game. Everything in the explorer window is inside of an object called game. To reference this object, you simply need to type: game. Then you can use the "." to look inside of this object.

Here's an example of pathing to the object "Part" that's located in "Workspace".

game.Workspace.Part

Now the game knows were talking about that object named part in the workspace. We can use the period key to find the children inside of our explorer objects, but we can also use it to reference properties that we can see in the properties window. 

Let's use our path, and the period to change a property of our part. Let's change it's name. We will need to path to our part, reference the property we want to change it to, then we will need to add an "=" to change the property, once we've done these steps, we will need to write what we want to set the name to. Being that a name is a string value, we will need to use quotation marks. 

Here is the finished code:

game.Workspace.Part.Name = "ChangedPartName"

Congratulations! You just wrote your first bit of code that influences your Roblox game. 

Conclusion

This is just the surface of what you can do with coding in Roblox. You can create anything you can imagine!  To learn more about Roblox coding, check our course The Basics Of Roblox Luau.

If you would like to see more about how you can get started with making your first Roblox game, check out this article: The Ultimate Guide to Creating a Roblox Game.

Thanks for reading, happy coding!

Recent Posts

Top 5 Ways to Make Robux From Your Roblox Game

Top 5 Ways to Make Robux From Your Roblox Game

(Roblox Scripting) Top 5 Tips For Making Side Income On Fiverr

(Roblox Scripting) Top 5 Tips For Making Side Income On Fiverr

How to Make a Roblox Animation in 60 Seconds!

How to Make a Roblox Animation in 60 Seconds!

Access The Training Now

We process your personal data as stated in our Privacy Policy. You may withdraw your consent at any time by clicking the unsubscribe link at the bottom of any of our emails.

Close