Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do you make an NPC from replicated storage die?

Asked by 3 years ago

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 497 — 3y

1 answer

Log in to vote
0
Answered by
Hacreey 49
3 years 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 497 — 3y
0
You need to describe your changes. Ziffixture 6913 — 3y
Ad

Answer this question