Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

2 comments

0

ty

0

Np

This discussion is preserved as it was. New answers, comments, and votes are closed.