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

My Health Gui help?

sc = script.Parent.Parent
txt=script.Parent.Text

player=game.Players.LocalPlayer
health = player.Humanoid.Health

sc.txt=player.health

It's suppose to tell you your health, but doesn't. Why?

1 answer

✓ Accepted answer

Actually it'd go a little somethin' like this:

sc = script.Parent.Parent
txt = script.Parent
player = game.Players.LocalPlayer
if player.Character ~= nil then
health = player.Character.Humanoid.Health
maxhealth = player.Character.Humanoid.MaxHealth
txt.Text = "Health: " .. health .. " / " .. maxhealth
end

and if you wanted it to show your health when you get hurt it'd go:

while wait() do
sc = script.Parent.Parent
txt = script.Parent
player = game.Players.LocalPlayer
if player.Character ~= nil then
health = player.Character.Humanoid.Health
maxhealth = player.Character.Humanoid.MaxHealth
txt.Text = "Health: " .. health .. " / " .. maxhealth
end
end

1 comment

0

Thank you! It works! :D

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