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

Health script not working?

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

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

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

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