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

How would I make a part that plays a sound when clicked?

Asked by
Swqu 0
7 years ago

I'm really new to scripting and I'm just barely learning onClicked functions. I want to make a part that when it gets clicked, it plays a sound. I don't want the sound to be played to the entire server though. How would I do this?

1 answer

Log in to vote
0
Answered by 7 years ago

part = script.Parent sound = script.Parent.Sound

function onClicked() sound:Play()

end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

This should work also you must inset ClickDetector and Sound into the part. FYI this is not a very hard thing to look for next time you should look else where.

0
Also please separate the sound = script.Parent.Sound by hitting enter Emperorverotic 0 — 7y
0
It actually is hard to find. When you google it you get "How to make a music GUI button" Swqu 0 — 7y
Ad

Answer this question