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

[Solved]How do i change MaxHealth Value ?

Asked by 4 years ago
Edited 4 years ago

Hello everyon,

Is it possible that the MaxHealth value is 8100 ?

I know how to change the Health and MaxHealth but my MaxHealth stucks at 8100 Health

i just have this to update MaxHealth value

while wait() do
    wait(1)
    local plr = script.Parent.Parent
    if plr then
        plr.Character.Humanoid.MaxHealth = 100+plr:WaitForChild("leaderstats"):WaitForChild("Power").Value
    end
end

and i don't know why but stucks on 8100

0
MaxHealth actually can be infinity. I don't know why your MaxHealth is stuck at 8100, so can you give us more imformation please. Block_manvn 395 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago
local char
game.Players.PlayerAdded:Connect(function(plr)
    char = workspace:FindFirstChild(plr.Name)
    char.Humanoid.MaxHealth = char.Humanaoid.MaxHealth + plr:WaitForChild("leaderstats"):WaitForChild("Power").Value
    char.Humanoid.Health = char.Humanaoid.Health + plr:WaitForChild("leaderstats"):WaitForChild("Power").Value
end)
char.Humanoid.Died:Connect(function()
    char.Humanoid.MaxHealth = char.Humanaoid.MaxHealth + plr:WaitForChild("leaderstats"):WaitForChild("Power").Value
    char.Humanoid.Health = char.Humanaoid.Health + plr:WaitForChild("leaderstats"):WaitForChild("Power").Value
end)

This should make it so that when a player joins or does their health is set to 8100. You can change the number of health to whatever you desire.

All the best,

PrismaticFruits

Ad
Log in to vote
0
Answered by 4 years ago

iI's ok i found the Solution.

First of all i am so stupid :D i have a DNA system and my max power was currently 8000 xD thats why 8100 was the limit.

and i had 2 scripts working with the MaxHealth i just made it liek t his now

    Power.Changed:connect(function() 
        if Power.Value > PlayerDNA then
            Humanoid.MaxHealth = PlayerDNA+100
        else
            Humanoid.MaxHealth = Power.Value+100
        end
    end)

Works fine now and i don't need a loop :)

Answer this question