How do you guys structure big systems?

so i’m making different functions for my UI in my game.

this is how i’m doing it at the moment. i will have module scripts for different functions so like this:

module script 1:
BlurScreen
module script 2:
TweenGui
module script 3:
HandleProductOnMouseClick

and so i would call these in my local script like this:

shopbutton.MouseButton1Click:Connect(function()
BlurScreen()
TweenGui()
end)

product.MouseButton1Click:Connect(function()
HandleProductOnMouseClick()
end)

just vaguely, that’s how i would go about it. would be open to any structuring tips, thanks guys!

Your structure is fine, there is no defined form for this, it depends on how you feel comfortable.

A compact form is like that:

local Buttons = {		--> Buttons list, It can be replaced with :GetChildren() and add a filter, ofc
	product,
}
for _, v in pairs(Buttons) do
	local m = ["path.to.modules_folder"]:FindFirstChild(v.Name)
	if not m then		continue		end
	
	local f = require(m)
	v.MouseButton1Click:Connect(f)
end

Compact, a button with the name and a module that returns a function.


Bad for specific cases but you should not “connect manually”.