Three basic rules to remember when learning programming
Note - this won’t directly answer your question - but will provide you a decent basis for self-learning - which is something you will need to learn to do.
When it comes to Any programming language - you have to remember two things.
- Computers are dumb - They can only take Precise instruction
- Most programming languages are the same - it’s their grammar or syntax that confuses people.
Let’s say you wanted to change the colour of a part named 'Steve’ in your game to Red
At the moment you will likely use either the colour tool in the Ribbon bar, or (hopefully) the explorer and properties window that you can open in the ‘View’ tab on the ribbon bar.
For anything scripting - you will need the explorer and properties windows
Let’s just go over these steps:
You would do this by selecting the part - going to its properties - clicking the colour property - picking the ‘red’ colour.
Simple right?
Sadly as mentioned computers can understand the above sentence, so how would a computer do this?
game.Workspace.Steve.BrickColor = BrickColor.red()
To get specific - you could say
game.Workspace.Steve.Color = Color3.fromRGB(255,0,0)
In case you don’t know - RGB represents 3 numbers (Red, Green and Blue) which scales between 0 (darkest) and 255 (brightest)
So the Syntax or grammar of Lua is the dot ( . ), and you specify which object you want to select by using exact names (a Part in Workspace called 'Steve').
You’ll notice also that name of the property we want to change is the exact same name as you would find in the Properties windows.
This means that any property in any object can be read and changed by a script.
The third and most important point
You need to learn where to find answers.
These Dev forums are great for trouble-shooting, but you should try to solve a problem thoroughly by yourself first. This way you’ll be practicing your logical skills - and should you need support you’ll be able to see what differences made your project work.
The two best resources to use is the Context Window in Roblox Studio (under View tab) and the Developer Hub (which replaced the Roblox Wiki).
Another great tool is the Object Browser which you can also find in the View tab - this will list all objects with their properties, events and functions as well as a brief description.
If you have any questions - hit me up.