Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

scripting a gui button with sound?

Asked by 8 years ago

i need help with adding music to a button gui. do i have to put it in replicatedfirst, and add sound?

1 answer

Log in to vote
0
Answered by 8 years ago

All you need is the GUI in PlayerGui, and a Sound instance in it (preferably inside the button) then you need this in a localscript (also in the button):

sound = script.Parent.Sound --change this to the path to the sound
script.Parent.MouseButton1Click:connect(function() --When a player clicks the GUI then...
sound:Play() --Play the sound
end) --Close the function

To answer your question: No, you do not need to put it in replicatedfirst.

Ad

Answer this question