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

Health script not working?

Asked by 10 years ago
while true do
    script.Parent.Text = "HP:" ..game.Players.LocalPlayer.Character:findFirstChild("humanoid").Health.. "/" ..game.Players.LocalPlayer.Character:findFirstChild("humanoid").MaxHealth
end

I renamed the Humanoid to humanoid. So there is no reseting or health bar.

Help?

2 answers

Log in to vote
0
Answered by 10 years ago

Here this should work you did this wrong :/

while true do
wait()
script.Parent.Text = "HP: " .. game.Players.LocalPlayer.Character.Humanoid.Health .. "/" .. game.Players.LocalPlayer.Character.Humanoid.MaxHealth
end
Ad
Log in to vote
0
Answered by 10 years ago

You forgot to add a wait() to your while true do end loop, I also edited your script.

while wait(0) do
script.Parent.Text = "HP:" ..game:serivce("Players").LocalPlayer.Character:WaitForChild("Humanoid").Health.. "/" ..game:service("Players").LocalPlayer.Character:WaitForChild("Humanoid").MaxHealth
end

Answer this question