Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make a player regen health faster?

How can I make a player regen health faster, do I have to make it in a script?

2 answers

✓ Accepted answer

--Finding the character
function waitForChild(parent, childName)
    local child = parent:findFirstChild(childName)
    if child then return child end
    while true do
        child = parent.ChildAdded:wait()
        if child.Name==childName then return child end
    end
end

--Variables
local Figure = script.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Humanoid")

--Start of Regen health
while true do
    local s = wait(0.01)
    local health = Humanoid.Health
    if health > 0 and health < Humanoid.MaxHealth then
        health = health + 0.1 * s * Humanoid.MaxHealth
        if health * 1.05 < Humanoid.MaxHealth then
            Humanoid.Health = health
        else
            Humanoid.Health = Humanoid.MaxHealth
        end
    end
end

2 comments

1

THANK YOU!

0

Yep, be sure to give rep and accept answer. :)

Im sorry if this isn't my thread, but does the script have to be in a local script?

This discussion is preserved as it was. New answers, comments, and votes are closed.