top of page

Roblox - Learning Logic.

Updated: Feb 26, 2021

“Logic is a method of reasoning that involves a series of statements, each of which must be true if the statement before it is true.” Collins English Dictionary

So you have decided to make a game in Roblox Studio. You have some grand ideas in your head, and start adding items and writing code, highly motivated up half the night, loving it! Then you come to a PROBLEM! A problem you think, “Ah ok, if I just do this then….” test - error!. “Ok, i’ll do this…..” test - error! I am sure anybody who has taken up coding has faced this dilemma and it can be extremely frustrating and in some cases cause you to become resentful of the project and abandon it to the “To hard basket”.

“Logical thinking is the process in which one uses reasoning consistently to come to a conclusion. Problems or situations that involve logical thinking call for structure, for relationships between facts, and for chains of reasoning that ‘make sense.’” Brain Building - Dr. Karl Albrecht

If you want to be a great coder then you have to love to solve problems. All day, and all night! And to do it well you must develop a method to think logically about the problems you are presented with.

What is a problem?

“A problem is a puzzle that requires logical thought or mathematics to solve it.”

Collins English Dictionary

The first step as a coder trying to improve is to be able to define what the problem actually is! Attempting to sit down a write a solution to a “vague idea of a problem” will either be met with failure, or if you do achieve a solution you have most likely “over complicated” it with a lot of extra code you did not really need.

The key is to be able to clearly express what the problem is in plain english BEFORE you start coding a solution. A good method for doing this is to use pseudocode.

A problem example

“How do I write a game where the player runs around and has to pick up logs to make a campfire?“

This is the game concept, and it is also a very vague problem. If I was to put this on a game forum as a question it just screams NOOB! Don’t get me wrong, experienced coders love to help others with problems, but you need to get a little more specific if you want them to help you, and that involves breaking the big problem into a list of smaller problems. One of the best ways to do this is to write a list of questions.

“How do I write a game?” - Because we are focused on Roblox here. we want to be clear that we are writing a game in Roblox Studio. So let’s re-write this question.

“How do I write a game in Roblox Studio”

Now we can get the attention of coders and others that know about coding in Roblox Studio.

“has to pick up logs”

Ok, let’s think about this. The player sees a log and runs over it, then they pick it up. How do we know they have picked it up? The obvious answer is that it disappears!

What I am doing here is using “imagery”, the process of describing a situation that lets you imagine the situation using pictures. So the next question is

“How do you make something disappear in Roblox Studio when a player runs over it?”

You can see here that up to a point I was able to describe in pictures what the problem was. Now we have a question that is specific. And we can then research how to solve it.

Great! I learned how to make a log disappear when a player runs over it, but does that mean the player picked it up? Well the answer is no. The log disappearing is called “visual feedback” to the player. They see it disappear when they run over it and they “think” they have picked it up. The reality is that you have uncovered another problem!

“How do I show the player they have a log?”

So with a little research we learn about “Leaderboards”, how to set one up and show the player “Has A Log” on the screen.

Pseudocode - What is it? How do I use it?

The process above let us break a big problem down into smaller problems, or a number of questions we need answers to, and this involves researching, learning new coding skills, and practicing coding solutions. Once you have a specific problem that you want to write code for you can start by using pseudocode. This is the process of writing code, using plain english, rather than using actual code.

Pseudocode Example

A player rolls a single die. (1-6) If they role a 6 I want to print the message ‘Well done! You rolled a 6!’ If they role anything else print “Keep Trying!”

This is a simple example of pseudocode. Now let’s write it as you might write code.

if player rolls a 6 then

print “Well done! You rolled a 6”


print “Keep Trying!”


Can you see we have taken our plain english problem, then put it into code format. Pseudocode will not work if you run it in a script, but it does let you set out your problem and read through it easily to see if it is logical.

Let’s think about our code running. Remember code runs from top to bottom, and left to right. The computer reads each line then executes each line.

The word “if” is a “key or reserved” word in Roblox Studio. When you type it into a script you will see it go bold and change color. This means it has a specific purpose in the coding language, and its own set of rules. In the case of “if”, this tells Roblox Studio that you are typing a “Conditional Statement”.

A conditional statement is understood by Roblox Studio as follows.

“Ok, you typed “if”. So you want me to “evaluate” whatever comes next, and if it is true run the code that follows”

The “if” conditional statement line ends with the word “then” which lets Roblox Studio know to run all the code below until it reaches the word “else”. To Roblox Studio the word “else” means “Ok, you asked me to see if something was true above, but it wasn’t so instead you want me to run the code below”.

The conditional statement is finished with the word “end” which lets Roblox Studio know you have finished the conditional statement, and am ready to move on to the next piece of code.

Practice, Practice, Practice!

The best way to learn how to address problems logically is to practice. Using conditional statements, for loops, while loops, functions, and the list goes on. The more you use these coding concepts the greater understanding you will develop about where and when to use them in coding your solutions.

Keep practicing, keep learning, keep coding!

If you want to learn more take my course “Learn To Code Games In Roblox Studio” available on Udemy. Click the link below to enroll.

151 views0 comments

Recent Posts

See All


Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page