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

Airplane Seatbelt Sign, how can I add audio to it?

I want to edit a script, and add more stuff to it, I want it to have sounds too. It is a seatbelt sign, and when I press the green button the seatbelt appears, when I press the red button it goes away, now with that clicking I want it not only to make it appear and dissapear, but it to make a noise like a ding, I have found a link to the sound I want: http://www.roblox.com/Airplane-Seatbelt-Warning-item?id=147060489

Now how do I put that into this:

function onClick() script.Parent.Parent.q.Decal.Texture = "http://www.roblox.com/asset/?id=128509825" script.Parent.Parent.w.Decal.Texture = "http://www.roblox.com/asset/?id=128509825" script.Parent.Parent.f.Decal.Texture = "http://www.roblox.com/asset/?id=128509825" end

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

Please help me out! I really want to get that done! :D!

Thanks, Monster363.

1 answer

✓ Accepted answer

Well, You can add the audio into the brick then play it from the script or make the script create the sound and play it. Here's the script:

function onClick() 
	script.Parent.Parent.q.Decal.Texture = "http://www.roblox.com/asset/?id=128509825"
	script.Parent.Parent.w.Decal.Texture = "http://www.roblox.com/asset/?id=128509825" 
	script.Parent.Parent.f.Decal.Texture = "http://www.roblox.com/asset/?id=128509825" 
	sound=Instance.new("Sound")
	sound.SoundId = "http://www.roblox.com/asset/?id=147060489"
	sound.Parent = script.Parent
	sound:Play()
end

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

You may want to add a wait() then remove the sound OR add it to debris so it wont hang around. Tell me if this works.

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