Sound plays on removal

I know there is a property on the sound itself, but its not even on. Basically I made this respawn script and when its suppose to destroy the monster, it does but the sound is still on. This makes it so two sounds are playing.

Code:

function Died()
	wait(1)
	local Clone = script.Parent:Clone()
	Clone:FindFirstChildOfClass("Humanoid").Health = Clone:FindFirstChildOfClass("Humanoid").MaxHealth
	Clone:makeJoints()
	Clone.Parent = script.Parent.Parent
	script.Parent:Destroy()
end

script.Parent:FindFirstChildOfClass("Humanoid").Died:Connect(Died)

I think whenever you clone the script’s parent it also clones the sound, and it may play whenever it’s cloned.

It does, but it should stop when it gets destroyed.

Which sound plays when it is cloned? The cloned sound or the sound that is getting destroyed?

They are both playing at the same time. When sounds get destroyed they should stop.

Is the sound already playing when it gets destroyed, or does it start when it’s destroyed?

Its already playing when it gets destroyed, so when its cloned it plays another one.

If you clone an instance, it also clones its properties. You need to stop the sound either before you clone it or after.

I destroy the sound making it unable to play. If I destroy a sound normally, it stops. If I destroy a sound in a model, it keeps playing. I don’t think you get what i’m saying.

So you’re saying if you destroy just the sound whose parent is a model, it keeps playing?

No, i’m saying if I destroy the model the sound still plays. :confused:

Well, I think you should stop the sound, then destroy it. See if that works.

Of course that would work, i’m asking why this bug is happening. I already have ideas of how to fix it.

I’m not sure why it is happening. You could file a bug report or ask someone to.

https://developer.roblox.com/en-us/api-reference/property/Sound/PlayOnRemove

1 Like

As i’ve stated, I said this property is turned off in my summary. :confused: