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!

1 Like

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”.

2 Likes

great structure, that’s how i usually do multiple buttons as well. thanks for the info sot!

1 Like

Quickly written this up to show you how I structure my UI. I think how you do your UI right now is okay, but I believe doing the way I do it makes everything more streamlined and modular.

ui structure.rbxl (67.9 KB)

2 Likes

that’s definitely how i imagined great structure tbh. i just had a look at your code as well and i learnt a few new things. thanks a million for taking ur time to do that example ren, i appreciate that a lot mate cheers! :slight_smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.