Humanoid Events not Firing

Hello everyone,

I am trying to make a respawn script for an AI in my game but for some reason neither the “HealthChanged” nor the “Died” events are firing at all from the main humanoid.

Here is my code:

local model = script.Parent:Clone()
local orig = script.Parent

local hum = model.Humanoid

local function died()
	task.wait(5)
	model.Parent = workspace.Entities
	orig.Scripts:Destroy()
	orig:Destroy()
end

hum.Died:Connect(function()
	died()
end)

I know for a fact the event isnt firing at all because I tried a print statement before any other code is executed within the connected function and it was never output to the console.

It is happening probably because the Script which runs this code is located under the Instance which is getting destroyed via Destroy method call.

Just found the cause I accidentally set hum to be the clone of the model instead of the original