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

My Health Gui help?

Asked by 10 years ago
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

Log in to vote
0
Answered by 10 years ago

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
0
Thank you! It works! :D Roboy5857 20 — 10y
Ad

Answer this question