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

How would I make a brick that plays sound when someone clicks it?

Asked by 7 years ago

I know I have to insert a Click Detector into the part, but where would I put the script for playing the sound? I dont know what the script would look like either but I could only assume it looks like this

``function onClicked()
````script.Parent.Play("https://www.roblox.com/GUI-Click-item?id=278467908")
end
``script.Parent.ClickDetector.MouseClick:connect(onClicked)

If this is correct where do I put the script, in the Clickdetector or the brick? Where would I put the ID for the sound to be played?

1 answer

Log in to vote
1
Answered by 7 years ago
Edited 7 years ago

The setup would be like THIS

And this would be the code for it:

function onClicked(Click)
    script.Parent.Sound:Play()
end

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

You'd need to put the sound ID in the sound instance:

Like THIS

Hope that helped.

0
ty yieldinglegoguy1234 0 — 7y
0
Np SHDrivingMeNuts 299 — 7y
Ad

Answer this question