Is putting all my GUI code in one script efficient?

Exactly what the title says, just wondering I have seen people do it a lot

It’s neither efficient or inefficient. It depends on the code itself and what its doing that’ll dictate the actual efficiency of the code. If we’re not talking about technical stuff, then having a monolithic script might be bad for your sanity. Consider if you can split it up into modules or something.

I’ll typically only write a single script for a Gui if it’s not performing much work. Any extra work that’s common between Guis I’ll split off into other ModuleScripts and in a properly structured project with a framework I might have one script act as the Gui’s main script with various submodules controlling other complex routines if necessary.

One script tends to be a whole lot less readable than multiple, but there’s also no sense in splitting up if you don’t need to do. Think of this in terms of a readability aspect more than a performance one because performance will be based on the code you’re writing, not necessarily how many there are.

CMIIW last part - multiple scripts might be negligibly worse if they’re all run like separate coroutines.

1 Like

I see, so its good, but got to make it readable, I have mine all commented and sectioned off to keep it readable at this time

As long as you space out the different bits of functionality of the script then it will keep a good efficiency and readability.