|
| 06 Nov 2014 02:40 PM |
I have an NPC with 1000 MaxHealth I set its regular Health to 1000 and it sets itself to 100 How do I fix that? |
|
|
| Report Abuse |
|
|
| 06 Nov 2014 03:27 PM |
Put this script in the npc
local Figure = script.Parent local Head = Figure:WaitForChild("Head") local Humanoid = Figure:WaitForChild("Humanoid") local regening = false
function regenHealth() if regening then return end regening = true while Humanoid.Health < Humanoid.MaxHealth do local s = wait(1) local health = Humanoid.Health if health > 0 and health < Humanoid.MaxHealth then local newHealthDelta = 0.01 * s * Humanoid.MaxHealth health = health + new Humanoid.Health = math.min(health,Humanoid.MaxHealth) end end if Humanoid.Health > Humanoid.MaxHealth then Humanoid.Health = Humanoid.MaxHealth end regening = false end
Humanoid.HealthChanged:connect(regenHealth) |
|
|
| Report Abuse |
|
| |