How do I create a brick?
Object Creation via Script
It is time to learn how to create different objects via script. Instead of using "Insert > Object.. > Script", a script line can be used. Almost anything and everything can be created via scripts, even a whole new functioning script.
Adding New Objects (Instances)
Now, to add a new object, we need to use the term 'Instance.new'. This term creates a new instance. An instance is a longer term for an object.
Instance.new("Part", game.Workspace)
So here in this command, we see the term 'Instance.new()'. So now, we state the objects class, which is in this case, "Part". Because whenever you create a new object, its parent is nil (nothing), we have to set it somewhere. You could put the parent of the newly created object right inside the parenthesis, separated by a comma. If you don't choose where to place the part, you can do it later.
Editing New Objects
In this section, I will be teaching you how to edit objects when using 'Instance.new()'. This is also where 'local' comes in handy.
local brick = Instance.new("Part") -- Creating the brick, this time without defining where to place it brick.Parent = game.Workspace -- Now our brick has an ascendant. brick.Name = "NewBrick" -- This name has to correspond with the name of your brick on the map brick.Size = Vector3.new(10, 10, 10) -- This is the size to which you want to change your brick
Sometimes when doing things like this, the list of things you edited can become really long, sometimes I edit every single property in an object. This could happen to you, so don't worry if your list is much longer than it usually is. Whenever I create a new object and want to edit it, I always make it a local variable. Now we are able to edit its properties by first noting its name, then noting the property. In this specific script, I put its parent into the workspace, then changed its name to "NewBrick", then changed its size to 10x10x10.