Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

1 comment

0

:Remove() is deprecated, use :Destroy() instead.

1 answer

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

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

2 comments

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.

0

You need to describe your changes.

This discussion is preserved as it was. New answers, comments, and votes are closed.