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

Why won't this GUI display health?

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?

2 comments

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.

0

Thanks! It's amazing how such small pieces of errors like that prevent whole scripts from not working!

1 answer

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.

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