Stop sounds command when entity remove?

Hello,how to doe a code for stop sounds played when the main entity is destroyed (take damaged) or remove,i try all,but nothing work,or show a lua error
The sounds are played in a random time and randon track

Thanks for you help

entity:StopSound() is currently not working. (If I remember correctly)
Your best bet is not to use a looping sound.

Create the sound and store it in a variable and use Play() and Stop()