How do I make all buttons in several different GUIs play a "click" sound all at the same time?

I’m making this game where there are different GUIs for different sections. For example: level, shop, premium, etc. I have several buttons and I want them to make a click sound at the same time.

Here are the GUIs. (I know, it’s a lot of buttons in there):

Screenshot 1:

Screenshot 2:
Screenshot (17)

And I have a local script outside the screen GUIs to do the task.

If you know how to group all of these buttons at once, it would be very appreciating.

You can’t exactly get them to play at the same time but you can get close. Though not sure why you would want to play all the sounds at the same time.

-- When button is pressed
-- Loop through the buttons
task.spawn(function()
   -- Play Sound
end)

-- or

-- When button is pressed
-- Loop through the buttons
coroutine.wrap(function()
   -- Play Sound
end)

These two methods should work.

You could do this script, parent it under startergui and should be localscript

local sound = -- put sound here

for _,gui in pairs(script.Parent:GetDescendants())
      if gui:IsA("TextButton") or gui:IsA("ImageButton") then
              sound:Play()
      end
end

1 Like

I realize that you forgot that at the mouse click function but it’s still worked anyway. Thanks!