Before we start, when I said "number things" or "number line things", I mean this (from ROBLOX studio);
Why should I keep my code clean?
Keeping you code clean is pretty important because you want to be able to read it when you need to debug, and if you need help with it, you want other people to be able to read it, too. You can think of it like handwriting. People will not know what you are writing if you handwriting is sloppy.
How can I keep my code clean and tidy?
The first thing I'm covering in this "tutorial" is indentations. They're the tabs you make when you're going to a new line from a variety of things, e.g., a function. The second line of the function should not be the same amount of tabs as the first one. Here is what I mean;
An example of bad indentation is this;
Now let's get more in depth (functions inside functions)
When dealing with functions inside functions, it is important to indent so you know which part of the code goes with each function. An example of a function within a function is this;
We can go even further and do 3 functions!
Notice how the ends also have indents. The amount of indents an 'end' has correlates to the number function it is. The first function's (printHi()) end gets no indents. The second function's (PlayerAdded) 'end' gets 2 indents, so on and so forth.