The Healthnumber on my Healthbar isn't decreasing, but the healthbar itself works properly?
Asked by
6 years ago Edited 6 years ago
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)
01 | local human = script.Parent.Parent.Parent.Parent.Parent.Parent.Human |
02 | local health = human.Health |
03 | local maxhealth = human.MaxHealth |
05 | human.Changed:connect( function (health) |
09 | script.Parent:TweenSize(UDim 2. new(human.Health/human.MaxHealth, 0 , 1 , 0 )) |
10 | script.Parent.Parent.Parent.Text = tostring (human.Health).. "/" .. tostring (human.MaxHealth) |
Image1
Image2