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...
1 | Sound = script.Parent.Sound |
2 | active = false |
3 | function onTouched(hit) |
4 | if active = = false then |
5 | Sound:Resume() |
6 | active = true |
7 | end |
8 | end |
9 | connection = script.Parent.Touched:connect(onTouched) |