Having troubles with humanoid's being invincible. Any help?
I am creating a NPC I'm having the problem that it's currently invincible. I ripped my coding out from another NPC and replaced some things (I hardly have any idea what I'm doing) and didn't seem to get it to work.
The Humanoid is named NPC.
01 | function waitForChild(parent, childName) |
03 | local child = parent:findFirstChild(childName) |
07 | parent.ChildAdded:wait() |
13 | local Figure = script.Parent |
14 | local Head = waitForChild(Figure, "Head" ) |
15 | local Humanoid = waitForChild(Figure, "NPC" ) |
20 | local health = Humanoid.Health |
21 | if health > 0 and health < Humanoid.MaxHealth then |
22 | health = health + 0.08 * s * Humanoid.MaxHealth |
23 | if health * 1.05 < Humanoid.MaxHealth then |
24 | Humanoid.Health = health |
26 | Humanoid.Health = Humanoid.MaxHealth |
Help would be greatly appreciated! :)