Chapter 1: Variables, values and types Chapter 2: Properties and Instances 2.1: Instances 2.2: Properties 2.3: Manipulating Properties of Instances 2.4: Hierarchy Chapter 3: Conditionals and If Statements Chapter 4: Functions and Blocks Chapter 5: Event Listeners
2.1: Instances

Simply put, an Instance is an object in Roblox. The most common Instance in Roblox is a "part" which is used when creating builds on Roblox Studio. However, an Instance can take many forms and they are all listed on developer.roblox.com

Although you may be overwhelmed by the amount of Instance that exist on Roblox, only a few are commonly used. Roblox has created Instances for many different uses which allows for endless creation.

Now that you know what an Instance is, how do we use it in our code?

Creating an Instance is as simple as writing
Instance.new("InstanceName")
where "InstanceName" is the name of the Instance you want to create.

But what is "Instance.new()"?

"Instance.new()" is a function which creates a new instance. You will learn more about about functions in Chapter 4, but for now, a function is just a block of code that changes something.

2.2: Properties

Properties are just characteristics of Instances. Most of these properties can be manipulated. For Example, a "Part" has a property of "BrickColor" which is just the color of the Part. This color can be manipulated.

To manipulate a property of an Instance we can write,
INSTANCE.PROPERTY = (NEW PROPERTY HERE)
,where INSTANCE is the variable name of the Instance and PROPERTY is the property we would like to manipulate.

Manipulating Properties will be discussed more in the next section.

2.3: Manipulating Properties of Instances

When creating an Instance, if we only write:
Instance.new("InstanceName")
we will not have access to that Instance later. This will only create the Instance but will not allow us to do anything with it.

This is where variables come in since we can create a variable to store the Instance under.
local Part = Instance.new("Part")
This will create a Part that will be stored in the variable "Part"

Referring back to 2.2, where we discussed how to access properties of Instances, we can change the BrickColor of a part by using the property "BrickColor".

Therefore, we can change the color of a Part to "Blue" by writing,

local Part = Instance.new("Part")
Part.BrickColor = BrickColor.new("Blue")

The Reason we use "BrickColor.new()" when changing the BrickColor of the Part is that the BrickColor of a part is a special type of value that is achieved by using BrickColor.new().

2.4: Hierarchy

Another important thing we need to cover on Instances is Hierarchy and how a Roblox Game is organized.

When we talk about Hierarchy, we are referring to how objects are identified and where they are placed in Roblox Studio.

In Roblox Studio, there are 14 main Services. What is the job of these Services? Each Service serves as a place where Instances are placed. Each Service has a different purpose and a limit to what objects can be placed in it. In this section, we will only cover the "Workspace". In later chapters, we will cover the purpose of each service.

The Workspace is one of the main services in Roblox, which is meant to hold objects in the 3D world. For Example, if we wanted a part to be displayed in the 3D world, we would have to place our part in the "Workspace".

But how do we place our object in the Service we want? We can either do it through code or by manually dragging the part to the Service we want.

Each object in Roblox has a "Parent" property, which dictates where the part is placed in our hierarchy. This "Parent" property can be manipulated through code. For example, going back to our Part that we set to the Color blue, we can set the Parent of this object to the "Workspace" so it can be seen in the 3D world.

local Part = Instance.new("Part")
Part.BrickColor = BrickColor.new("Blue")
Part.Parent = workspace -- Here we change the Parent of the part to workspace, where it can be seen in the 3D world.

There are 3 different ways we can access the workspace. One way which is shown above is by simply using the keyword "workspace".

Another way is by accessing the main Parent of all Services which is "game". By writing, game.Workspace, we can gain access to the Workspace.

Finally, since the Workspace is a service, we can also write, game:GetService("Workspace"), to gain access to the Workspace.

Chapter 3: Conditionals and If Statements