How to write less code/shorten my code? Or just make things more organized

Not really sure where this belongs, but a scripting question I have is how can I improve my code and write things shorter or just genuinely keep things more organized? I still have a lot to learn so a lot of the things I write probably are just long and messy ways of doing something I try my best to shorten it when I can, but due to lack of knowledge I just end up leaving it the way I know how to do it. I assume something like this just gets better over time, but what are ways I can start getting into better habit and stuff :slight_smile:

I personally use modular coding with functional programming as my secondary paradigm

Store things in arrays, this allows you to bypass the max number of local variables too, can take getting used to but your see why I use this

Use functions for things you use alot, like datastores.
I have scripts with functions Ive made ready for use, this means you can just copy and paste or put it into a module.

Temporary variables, I like usimg my array system to make temporary variables so I dont have to type the full name each time

For this part I recommend using comments

It depends on how you base your code/structure it.
Every programmer has their own unique way of structuring their code that they either learned from someone else and changed depending on how they see fit or just created on their own, you could call your code organised and somebody else would call it unorganised due to what they’re used to.

Shortening code and writing organised code are completely different things, point being is even if your code is short it doesn’t mean it’s organised, to write organised code you need to have a set pattern for everything, there are many plugins that help with that (in Visual Studio Code.)
As I’ve said above, have a set pattern of how you write code, like keeping up the same amount of whitespace after each if statement, or your naming-conventions. There are also multiple guides that help you with that, like: Roblox Lua Style guide
It really comes down to preference and the studio you’re working with, they might even demand you to use certain conventions, I think you should just come up with your own “style” and keep up that pattern, that way you’ll be able to write neater and more organised code with time.

This is obvious but I thought I would put it out there. Refrence parts with variables as often as you can, and it will greatly shorten your code.