1

# How do you make an NPC from replicated storage die?

I have this script that doesn't remove the model when it dies

Script-

CarnoNPC = script.Parent

if CarnoNPC.Humanoid.Health == 0 then

CarnoNPC:Remove()


end

0
:Remove() is deprecated, use :Destroy() instead. RazzyPlayz 465 — 1mo

0
Hacreey 49
1 month ago

Looks like you are only checking the health once. Try this instead:

CarnoNPC.Humanoid.Died:Connect(function()
CarnoNPC:Destroy()
end)

0
That's a more efficient way to do it, however, in his case, the NPC will not get destroyed because the scripts will not run as it is in ReplicatedStorage. RazzyPlayz 465 — 1mo
0
You need to describe your changes. Ziffixture 6786 — 1mo