Scripting for beginners! | Start scripting!


Hello, welcome to this resource you may consider calling a tutorial if you wish. If you are a pro at scripting, I urge you to click off this topic. If you are a beginner to scripting (Know little or don’t know any scripting things of that nature) then welcome! Here I will cover some basic scripting with a step-by-step guide! Let’s get started!

Table of Contents

  • Part 1: Building the trap
  • Part 2: Inserting the script + explorer introduction
  • Part 3: Variables and shortcuts
  • Part 4: Functions, waits, CanCollide
  • Part 5: Transparency and code roundup
  • End and recommended plugins

Part 1: Building the trap

This part is optional. Scroll down if you already have something to build off of. But here we go!
It’s just an empty small map. Let’s change that!

Step 1 Picture

Try to make something like this to start.

Step 2 Picture

Then insert a cylinder as shown in the picture.

Step 3 Picture

Next, make a small, floorless cage thing.

Step 4 Picture

make a red, diamond plate floor for that floorless cage now. Should be easy not including picture.


Part 2: Inserting the script + explorer introduction.

So now we came to our next part! Congrats! however, that doesn’t mean it gets easier… Insert a script! What? You don’t know how? OK. Go into: View < explorer! now in the trapdoor part (red, diamond plate part) click the little plus to the side and insert a script. Call it “TrapdoorScript”.

Part 3: Variables and shortcuts

Variables allow you to use one thing and use it throughout one script as a shortcut instead of writing “script.Parent” over and over, variables are quite useful, we will be covering them throughout this part!
Start by adding the following:

local Trapdoor

It’s a good start! but it doesn’t contain anything to make us a shortcut. So continue off your variable like this:

local Trapdoor = script.Parent

Now you have a variable for a shortcut! now, here’s a shortcut, press tab when your ready to auto finish intended parts for the script (sometimes doesn’t do this).

Part 4: Functions and CanCollide

Ever wondered how you moved through some objects in some games? Ever wondered how the same piece of code is useful in other parts of one script? This part covers that!

Lets complete the essentials to our script, it should look like this:

local Trapdoor = script.Parent

local function openTrapdoor()
       Trapdoor.CanCollide = false

The function allows it to be used throughout our script multiple times, it does nothing right now, but in the next and last part we will finish the script so it does what it needs to do.

Part 5: Transparency and code roundup

The part you’ve all been waiting for, the finish of the script! Here, we will find out about transparency properties and the finished code(code roundup). Let’s get into it!

First, we need to answer the question, “What is the Transparency property?” Well, transparency determines whether you can see an object, or not. Transparency 0 you can perfectly see it. But Transparency 1 makes it entirely invisible. Anything in-between is a little see through.

Now let’s put it in our function. Heres what the function part of our script should look like:

local function openTrapdoor()
Trapdoor.CanCollide = false
Trapdoor.Transparency = 1

IMPORTANT: if you want organized code, keep the indents that the script made for you!

Now when we run it- Wait… It doesn’t do what it’s supposed to! Try this:

while true do:

It should work now! Here’s our final code:

local Trapdoor = script.Parent

local function openTrapdoor()
Trapdoor.CanCollide = false
Trapdoor.Transparency = 1

while true do

End and recommended plugins

This wraps up our code, feel proud, you made an advancement to be able to code, go out and make some awesome games! One more thing, a recommended plugin to help you develop, try installing the Studio+ plugin, not including a link cause it’s easy to find in the plugin library. Good luck new developers!


I would suggest changing it to when the part is touched as this could be a useless loop running constantly. But great tutorial anyway!


You shouldn’t assume your audience has basic knowledge of studio, furthermore this is a scripting tutorial not an introduction into building.

If you want to cover both building and scripting than I recommend modifying the title OR using a similar format to

Optional building lesson

Not every scripter is interested in building just as not every builder is interested in scripting. We learn what interests us whereas we disregard the rest if it isn’t relevant to our case.


I edited it to say that the part is optional, so that should fix things hopefully!

I made it edited to have a return at the end of the loop. I’m not the best programmer don’t judge me!

It’s all good! It’s just habits you get into.

You should really test code before putting it in a tutorial, because this won’t work at all. Please don’t write tutorials “teaching” people how to script when you don’t know how yourself. return is used within functions, and there’s no function around the while loop. openTrapdoor is also not a complete statement, so you can’t just write that with nothing else. You could’ve figured this out with less than 5 seconds in studio. Also, why would you wait(0.7) in the loop and wait(5) in the function? Just wait for 5.7 seconds in either spot rather than having separate waits.

1 Like

He did say:

However, I do have to agree that you should test your code. I personally write my code in Visual Studio code and then I test it in Studio.

1 Like

Not being the best programmer is fine, but he really shouldn’t be trying to write tutorials until he at least understands what he’s doing himself.

I agree, but he was just trying to help (he still should be testing the code). And don’t forget that a good way of learning something is explaining it.

1 Like

When i started to script i was about to give up, because i could’t do the same as all other.
So what i would recomend u is just make something small, maybe a small UI that makes a sound that sounds like nothing, but u actually learning really much. The last thing i want to say is that “U have not failed until u give up” Greeting from dr6g0nb0y

Good Luck