How can I Make an Unkillable NPC?

This is a very simple problem, but I can’t seem to figure it out.

How can I make an unkillable NPC?

I don’t want the health bar to show for the NPC if it takes any damage, and I want it to be unkillable.

I already tried putting a forcefield in it, but it still dies for some reason.

Just use the command bar to set its max health and then health to math.huge, and set the DisplayDistanceType to None.

Also this is probably for #help-and-feedback:game-design-support

1 Like

Bit of a hacky way to do it but…

if health ~= 100 then
  health = 100
end

I don’t know what the actual variable for health is so change it to whatever is right.

While editing the max-health property, just spam the numeric keys on your keyboard repeatedly till as long as you like. Also, set the health property to be the same as the max-health property.

This way, if the player takes exactly 100 damage they will just die. It’s best to also add a line like:
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead,false)

This line ensures that the rig won’t die at all. This way, you wouldn’t even need to use that hacky method of yours, just insert a script in the humanoid and run that line.

To OP:

Move the topic to #help-and-feedback:game-design-support as well please. This is not a creation.

1 Like
NPC.Humanoid.HealthChanged:Connect(function(hp)
   NPC.Humanoid.Health = NPC.Humanoid.MaxHealth
end)

^ Basically nullifies any damage taken by the NPC. You can also disable the Dead humanoid state.
And I recommend setting the MaxHealth to something high, like math.huge as someone else suggested

1 Like