The only few tips I know to help you are
Good Habits
-
Use
localbefore the declaration of a variable/function. It’s not required but a lot of developers use it so it’s honestly best to use it as well -
Name your variables/function the same as their purpose. Say you have a function that is supposed to add 2 numbers together. It’s best to call it
Add2Nums()for example instead of anything unrelated to it, it can help having to comment code that can be confusing to understand since right names can act as comments of their own -
Comment code that can be hard to understand and can’t all be explained by proper naming. Make sure it properly details what something does.
-
Don’t Repeat Yourself. What I mean by this is if you ever find yourself in a situation where code has to be repeated, such as make multiple scripts with the same purpose, don’t. Find a way to only have to use that code once but can be used by multiple things. For duplicate code in the same script it’s simple, just make a function and reference that function instead, but for other things you’ll have to get creative
Bad Habits
- Using the 2nd parameter for
Instance.new(). The 2nd parameter is used to assign the Instance a parent, it’s slow to use than just declaring the parent at the end.
-
Focusing way too much on optimizations. Usually some programmers tend to find as many ways to optimize something when in reality those optimizations are so small that they won’t do any difference and can just harm readability, focus on the minor optimizations that are common use
-
Overcomplicating. Making your code simpler to do a specific task can often be more pleasing to look at/improves readability and can help when debugging. If you don’t know how to make something using simpler methods, you can try to research.
That’s currently all the habits I have in my head that could be of use to you