Hi, I was wondering how I can, if possible, make a function run if one of the descendents is clicked when I use GetChildren()? Is there another way besides making a function for each individual button?
local buttons = script.Parent.Frame:GetChildren() buttons.MouseButton1Click:Connect(function() print("click") end)
You need to connect a clicked event on the button's children using a for loop.
local buttons = script.Parent.Frame:GetChildren() --Connecting click events on the button's descendants. for _,v in pairs(buttons) do v.MouseButton1Click:Connect(function() print("click") end) end