so basically im a bit stuck at the moment. i’m trying to make my game modular but i’m not sure how to handle multiple UI’s that well. i have buttons like Shop, Inventory, Craft which will all have different functions but i can’t seem to connect the dots.
this is my UI Manager so far. i have my MouseEnter, MouseLeave, MouseButton1Click functions all in the one function which i call once in a local script. i’m probably doing this very badly but anyways. thanks i appreciate any help! ![]()
function UIAnimator:TagUI()
for _, instance in ipairs(PlayerGui:GetDescendants()) do
if instance:IsA("GuiObject") then
CollectionService:AddTag(instance, "AnimatableUI")
--print("tag added to "..instance.Name)
end
end
end
function UIAnimator:AnimateUI()
for _, guiObject in ipairs(CollectionService:GetTagged("AnimatableUI")) do
if guiObject:IsA("GuiObject") then
local guiObjectSize = guiObject.Size
guiObject.MouseEnter:Connect(function()
UIAnimator:SizeUp(guiObject)
SoundManager:Play('Hover')
end)
guiObject.MouseLeave:Connect(function()
UIAnimator:SizeDown(guiObject, guiObjectSize)
end)
end
if guiObject:IsA("TextButton") or guiObject:IsA("ImageButton") then
guiObject.MouseButton1Click:Connect(function()
SoundManager:Play('Click')
end)
end
end
end