The purpose of this guide
This guide is for those who have absolutely no understanding of what scripting is and aren't able to write a single line of code. This guide won't teach you how to make the awesome stuff that has probably drawn your attention to this subject, but this will teach you what scripting is so you are at least capable to study all those tutorials and scripts made by others.
Note that this guide is focused on teaching the reader the main principles of scripting in ROBLOX and a way to get started with it, not to confuse the reader with complicated terms and being precise or exact.
Scripting is what actually makes blocks in ROBLOX do things, and without it your character's limbs wouldn't move when you are walking and a rifle would just be a bunch of parts being held by your character. In short: scripting is what makes ROBLOX come to life and make places fun. It is very understandable that people want to learn how to do it and make cool places. Contrary to popular belief, scripting isn't hard at all, it's just something totally new that you need to understand first.It's very simple to make scripting easy. Just read these passages
Alright, to start writing a script you will need to work with 'Roblox Studio'. This is a program that makes you able to edit places with more advanced tools and in a 'non-running environment', which basically means that scripts aren't running and gravity and motors do nothing while you're editing. If you have ROBLOX installed on your computer you should have this program - you can normally start it from Start Menu > Roblox > Roblox Studio. Now you will see the normal ROBLOX site just like you know it, now either go to "File (in the bar on top of the screen) > New" or to "My Roblox > Places > Edit (not Build)". You will now see a bunch of clouds and bars you most likely don't understand. Let me explain the basics:
On the right of the screen
Explorer: All the objects in your place, including the place itself, are listed here.
Properties: When you select an object in the Explorer or inside your viewport, the properties of that object will be displayed here.
On top of the screen
Toolbar: Icons with all sorts of tools you can use to change your place (moving/resizing parts, etc). Fiddle around with these tools and see what you can do with them. Once you're familiar with what each tool does, create a brick and resize it to create a floor.
(If you cannot figure out what each tool does, a detailed tutorial for ROBLOX Studio can be found here.)
Within the tutorial after this one, we will learn to create a script that activates once the brick it is in is touched.
Writing a script
In order to create a script, go to Insert (at the top of the Studio) > Objects... then double-click "Script". Now you can start writing a script. This guide won't go in-depth on writing scripts itself but it will tell you the basic understandings of it. First: the text within a script is called 'code' or 'source', the code tells the script what to do when it starts running. Double-click a script in the Explorer to view its source.
So far the easy part, first thing you should know about scripting is what a path is, a path is a piece of text that represents an object in your place. In a script your place is called 'Game', and the object that holds all present objects in your place is called 'Workspace'. So when we want to access a object in your place:
find workspace from game, then find the object in workspace
A path in ROBLOX scripting is (usualy) seperated by dots, so the previous example would look like this in valid scripting:
But object is nothing, so lets say we want to access the name of a script that is in the workspace, which is in turn inside the game.
game.Workspace.Script.Name = "Script"-- This is the name for what ever you name the Script
Now we want to change the name of a script, so what we must do is add an "equals" sign to the script - this basically tells the script to assign a certain value to a certain space, which is, in this case, the script's name.
game.Workspace.Script.Name = "Something"
When this script would run the script's name in the explorer would change to 'Something'. Note that 'Something' is written between double quotes ( " " <-- those things). this is because we want the name to be displayed as a text value. Text values are called 'Strings', scripts need them to see the difference between calculations, operations, number values, and text values.
To run your script, click the green 'play' button at the top of your screen. If the script's name changed to whatever you entered it to be, then congratulations! Your script works!