In my game, I have several NPC that is very important to the game, that should not be killed. Therefore, I am trying to make them immortal so no one can kill them. I tried 2 methods listed below, but all of these seems not to be able to protect npc from directly setting humanoid`s health to 0 or breaking joints. Is there anyway to make them completely immortal, or even lock the property of humanoid so it is unchangeable?
--method 1 :
npc.Humanoid.MaxHealth = math.huge
npc.Humanoid.Health = math.huge
--method2
while wait() do
npc.Humanoid.Health = math.huge
end

1 comment
Couldn't you just add an if statement to check to see if the Humanoid is an npc (using either.Name, or the location, or better yet put them all in a folder and check the folder)? If it is, then you can do whatever you want (0 damage display, gui that says something).