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?
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?
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
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Thank you! It works! :D