how do i make a dummy/npc in roblox studio unkillable?
1 Like
local npc = script.Parent
local function preventDeath()
local humanoid = npc:FindFirstChild("Humanoid")
if humanoid then
humanoid.Health = humanoid.MaxHealth
humanoid:GetPropertyChangedSignal("Health"):Connect(function()
if humanoid.Health < humanoid.MaxHealth then
humanoid.Health = humanoid.MaxHealth
end
end)
end
end
-- Optional: Prevent other damage attempts (like explosions)
npc.DescendantAdded:Connect(function(part)
if part:IsA("Explosion") or part:IsA("Fire") then
part:Destroy()
end
end)
preventDeath()
Add this script into your npc… i made it a few months ago, I don’t really need this code anymore so there you go. There might be better ways to do it but I hope it helps
1 Like
it worked but how do i hide the npcs health bar
Go into the npcs humanoid and set the display and health to disabled. I forgot what the property is called.
2 Likes
Also, you can just set the npc’s health to infinite. No need for the fancy scripts.
HealthDisplayType
1 Like
How Do i make the health infinite?
bro has never seen a forcefield in his life
math.huge. this post probably has been created many times.
4 Likes