Hello!
I want to make a script where when I click a button, a bell sound plays. It’s fairly simple, I just don’t have much scripting experience. Any help would be appreciated!
Hello!
I want to make a script where when I click a button, a bell sound plays. It’s fairly simple, I just don’t have much scripting experience. Any help would be appreciated!
Add a ClickDetector in the part, then add a sound in the same part. Put whatever AudioId you want into the sound.
Finally add a new script in the same part, and copy/paste this code in:
local audio = script.Parent.Sound --Define the sound and ClickDetector objects in a variable
local cd = script.Parent.ClickDetector
--Create a function when the click detector is clicked
cd.MouseClick:Connect(function()
audio:Play() --Play the audio and close off the function with end)
end)
When you click the part it should play whatever sound you put in it.