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

Why won't this GUI display health?

Asked by
nilVector 812 Moderation Voter
10 years ago

This is in a local script with the GUI being the script's parent.

local text = script.Parent.Text
local humanoid = game.Players.LocalPlayer.Character.Humanoid

humanoid.HealthChanged:connect(function(health)
    print(health)
    text = health
end)

It prints the health correctly in the output, but it doesn't want to display it in in the GUI for some reason. Can someone please help me?

0
Set sp to script.Parent then do sp.Text = health. You can't access the text directly, you have to change the property, not just the variable. GoldenPhysics 474 — 10y
0
Thanks! It's amazing how such small pieces of errors like that prevent whole scripts from not working! nilVector 812 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago
local text =script.Parent.Text
local humanoid = game.Players.LocalPlayer.Character.Humanoid
humanoid.HealthChanged:connect(function(health)
print(health)
text=tostring(health)
end)

This should work. Im just making health a string. If it doesn't work then sorry.

Ad

Answer this question