How might I be able to add sound to a script when on impact? I have a touchable explosion brick, but how do I add the 'explosion' sound to it?
script.Parent.Touched:connect(function() local sound = Instance.new("Sound", script.Parent) --Second argument is the parent Sound.SoundId = SoundIdHere --Replace this with a sound ID Sound.Volume = 1 Sound.Pitch = 1 Sound:play() wait(Sound.TimeLength) --I don't think this works yet. Sound:remove() --Or :Destroy() end)
This script adds a sound with the explosion sound when touched by anything.
****Put into a part with the sound you want it to play, Change ONLY WHATS ASKED
Sound = Script.Parent:FindFirstChilD("SOUNDNAMEHERE") -- Replace with name of song function onTouched(hit) Sound:Play() end script.Parent.Touched:connect(onTouched)