Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Default health not regenerating?

Asked by 5 years ago

So I gave up on the custom health gui and just decided to stick with the default one roblox gives you and whenever I play in studio it gives my character a script called "Health" which contains this

-- Gradually regenerates the Humanoid's Health over time.

local REGEN_RATE = 1/100 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = 1 -- Wait this long between each regeneration step.

--------------------------------------------------------------------------------

local Character = script.Parent
local Humanoid = Character:WaitForChild'Humanoid'

--------------------------------------------------------------------------------

while true do
    while Humanoid.Health < Humanoid.MaxHealth do
        local dt = wait(REGEN_STEP)
        local dh = dt*REGEN_RATE*Humanoid.MaxHealth
        Humanoid.Health = math.min(Humanoid.Health + dh, Humanoid.MaxHealth)
    end
    Humanoid.HealthChanged:Wait()
end

I have made no changes to this yet the health still wont regenerate when I get hurt i've been trying to fix this for hours help

0
line 08, local Character = game.Players.LocalPlayer.Character Spiritlotus 151 — 5y
0
I typed that in on line 8 and nothing changed it still wont regen THEGOBLINTOPLAD 0 — 5y

Answer this question