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

Audio still plays after being removed?

Asked by 8 years ago

I'm using an OnTouched script to play a sound. The problem is, once the model the sound is located in is removed, it continues to play. I need for the sound to stop playing once removed. No, PlayOnRemove is not set to true. Can anybody help with this? Here's my code...

Sound = script.Parent.Sound
active = false
function onTouched(hit)
    if active == false then
        Sound:Resume()
        active = true
    end
end
connection = script.Parent.Touched:connect(onTouched)
0
Not sure if this would work, But instead of using Sound:Resume() try using Sound:Play() and Sound:Stop(). KordGamer 155 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

You have to loop it for god knows why.

Ad

Answer this question