Hello, is there any faster method to play sound everytime when player clicks any gui button then putting to every onClick local script line that plays sound?
I believe making a sound play on an .Activated or .MouseButton1Down event are the most convenient way’s to do so. Why do you ask?
I have really a lot gui buttons and putting line to every script will take a lot time so i asked if there is any faster method
If your using only one click sound, use a for loop to iterate through all the guibuttons and establish an .Activated or .MouseButton1Down connection from there
for i, Button in pairs(GuiFrame:GetChildren()) do
if Button:IsA("GuiButton") then
Button.Activated:Connect(function()
--play your sound here
end)
end
end
1 Like
Thanks! I didn’t know that i can iterate through instances and connect them all with function :)))
1 Like