Ad
Log in to vote
1

How do you make an NPC from replicated storage die?

Asked by 1 month 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 465 — 1mo

1 answer

Log in to vote
0
Answered by
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
Ad

Answer this question