Don’t worry, that’s hardly a lot of code. Most full games have tens or even hundreds of thousands of lines of code in some cases. Mine usually have 10k-70k lines. That said, I follow a few practices to avoid having an excessively large script.
I think the best way to keep scripts concise is to use module scripts. For example, if you need a part of your script to handle particle effects, throw it in a module scripts and use functions in the main script like Module:CalculateParticles()
instead of putting a 300 line function into your main script.
Instead of having 30k long scripts, I usually just make a dozen module scripts, put them in folders based on their category (ie Data Stores, Effects, Map loading, chat, etc) and then just require()
them into whatever code I need. This is also an excellent way to avoid repetition.You can also creatively use bindable events and bindable functions to communicate between two scripts.
All this being said, it’s okay to have scripts or modules that are a couple thousand lines long. My point is to cut down where possible, don’t just split a script in half.
If you do need to make a really long code block in one script, you can collapse it in the editor by clicking on the little ‘>’ arrow icon. You can also make code blocks using
do
-- some code
end
And collapsing the do end block.
But like I said, use module scripts and don’t worry about having lots of code.
Finally:
Even if your game has 100,000 lines of code, that’s only 1 - 10 MB of data. Your hard drive can store LOTS of data, so even a game with 100,000 lines of code would only be a very small percentage of total storage.
EDIT: Excuse me, not 100 KB, I was stupid and got character count mixed up with line count.
If we assume that each line of code has 50 characters (from 20-100), 50 * 100,000 = 5,000,000 = 5 MB