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

How do I make a brick that plays a sound effect every time you touch it?

I've tried putting the soundID into a brick then touching it but it doesn't play sound effects. I've also tried adding a different sound inside the brick and sure enough it doesn't work. What do you think I should do ?

1 comment

0

Put the code that you've tried in your post, then maybe we can see what the problem is

2 answers

I found this that could help you out. It kills and gives a sound but you can just remove the kill and change the sound; function onTouch(part) local humanoid = part.Parent:FindFirstChild("Humanoid") local sound = script.Parent.Bowser

if (humanoid ~= nil) then humanoid.Health = 0 sound:play(1)

end end

script.Parent.Touched:connect(onTouch)

1 comment

0

Sorry the code mest up when I submitted it.

I haven't tried this before but this might look like this:

local part = game.Workspace.Part

function onTouched()
	part.Sound:play() -- put the sound on the part for this to work
	wait(5)
	part.Sound:Stop()
end

part.Touched:connect(onTouched)

Try reading something about the sound:

http://wiki.roblox.com/index.php?title=RBX.lua.Sound_(Object)

The wiki says that sound requires a preload for it to work. Try reading something about preload too:

http://wiki.roblox.com/index.php?title=Preload

Hope that helps!

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