Frontend scripting/UI scripting is probably my biggest weakness partly due to not knowing how to organize the code because you might have so many menus and buttons and different interactions how do you control all that in a somewhat elegant way. What I was thinking of doing is having some sort of context system where you could push and pop menus and then each menu would have its own corresponding module script, but I’d just like to gather some advice or tips to get a better understanding.
what i learnt as i made more ui intensive games was how helpful collectionService’s tags are
for example if you tag every back button as backButton, you can use collectionService to check if any backButton was pressed and then disable it’s parent (ScreenGUI),
ex: using collectionService to universally implement backButtons
for i,v in pairs(collectionService:GetTagged("backButton")) do
if not v:IsA("GuiButton") then return end
local button:GuiButton = v
button.MouseButton1Down:Connect(function()
if button.Parent:IsA("ScreenGui") then
button.Parent.Enabled = false
end
end)
end
additionally, the most important thing for me is labeling everything correctly so i can move around faster and having a somewhat uniform structure to my ui
1 Like
I’ve only recently started utilizing collection service and I haven’t considered using it for UI so very interesting usage I’ll definitely give this a try.