Stoping sound when the sounds parent is nil?

Here’s the situation:
I create a sound and play it:


self.sound = CreateSound(self.ent1, Sound(".wav"))
self.sound:Stop() self.sound:Play()

I try to stop the sound if the ent1 is not valid:


if !ValidEntity(self.ent1) then self.sound:Stop() end

The entity that the sound was originally created is still valid, but the entity which the sound is set to emit from is not.
How do i stop the sound without causing all the other sounds currently playing on the map to stop aswell?

Do it in ENT:OnRemove().

If it’s not a scripted entity, use entity:CallOnRemove().

Sorry that i answer only now… God damn vacation… Anyway…
When i try calling the CallOnRemove() it calls the code instantly… not on remove :confused: so could someone give some examples or something cause i cant figure it out…