How to make sure that no matter if the button is in Playing, Menu or in PlayMenu the sounds activate?

for i, Button in pairs(script.Parent.Frames.Playing:GetChildren(), script.Parent.Menu:GetChildren(), script.Parent.PlayMenu:GetChildren()) do
	if Button:IsA("TextButton") then
		Button.MouseButton1Down:connect(function() script.Parent.Button:Play() end)
	end
end

1 comment

0

You would need to put the mousebutton1down signal outside of the for loop, and the foor loop inside of that. You can connect a signal to a function inside the script, not in any loops or other functions