So I've created a healthbar and it works fine. I have added a "NumHealth" which shows how much HP you have left, example = 100/100HP, and when the mob hits you for 5 damage, it will show 95/100 HP, but I simply can't get that to work. I just get the error: Text is not a valid member of Frame (Error is on line 10)
local human = script.Parent.Parent.Parent.Parent.Parent.Parent.Human local health = human.Health local maxhealth = human.MaxHealth human.Changed:connect(function(health) if health then script.Parent:TweenSize(UDim2.new(human.Health/human.MaxHealth, 0, 1, 0)) script.Parent.Parent.Parent.Text = tostring(human.Health).."/"..tostring(human.MaxHealth) end end)
from what I understand from the image you posted you should do
script.Parent.Parent.Parent.Parent.Parent.Parent.NumHealth.Text = tostring(human.Health).."/"..tostring(human.MaxHealth)
Alright, I found the mistake, thanks for the help!
script.Parent.Parent.Parent.Parent.NumHealth.Text = tostring(human.Health).."/"..tostring(human.MaxHealth)