If you ever work with someone else on code, it’s best to organize your code into modules that serve a specialized function. While it takes more effort, it makes your code much less esoteric.
I’ve made a semi-popular building plugin that used no modules (it was developed before they were even a thing), and it had thousands of lines. It worked perfectly for my purposes, and it took a lot less time to build than it would have if I had used modules (I tried making a module-based plugin once, but quickly lost all motivation, though I’ve always been absorbed in other projects anyways). With long, single scripts, you can make your code a lot more esoteric and ad-hoc. However, whenever I try making edits to that plugin now, I forget everything about its organization, and have to jump around between functions to figure out what sections of code are responsible for what.
That’s fine if you’re working by yourself and don’t really plan on expanding the codebase any further than what it’s already been expanded to, but if you ever want to work with other people (especially since, on team create, only one person can edit a script at a time), modules let other people (such as your future self) figure out what the hell is going on with your code by the mere fact that everything is organized much more robustly.
When you have modules laid out in a folder, you can pinpoint exactly what part of your code you need to make changes to, rather than having to dig through thousands of lines in functions. It’s also a lot less performance taxing, since shared functions can be grouped together in one big thread (which is what you want in your code).
There are some other things. For example, it forces a server/client distinction (whereas if you have two things of the same name in the _G table, one will override the other in Play Solo, which fundamentally breaks solo testing). Also, one cool thing about modules, is that they’re only stored in memory once on a server or a client. Therefore, they can be used similarly to a localized _G table, that can be interfaced by all of the things that need them. You can read and write to a required module, and it will affect all other instances on the same server/client that accesses that module. Play Solo cuts the time it takes to launch a test in half, so using modules instead of _G for things like that helps a lot.