Structuring code

So right now I have an inventory UI with a single LocalScript under the ScreenGui which has any code that directly affects the inventory UI. Said script firstly draws the inventory UI, then draws updates to the inventory, then adds functionality to buttons in the inventory, and is increasingly growing in size.

How would you organize all the code that has to do with the inventory UI, but not jumble it in one script?

Use different module scripts each doing a different thing and then use your script to bring it all together.

I would either create multiple scripts in the gui, or try to use functions. also be warned that using only local scripts can cause some non-replicated things so be careful!