|
| 06 Jun 2013 12:16 PM |
I am trying to make it where my health bar will decrease in size as the health number actually decreases in value, yet the bar does not wish to move is it should. I know my declarations of the humanoid are fine along with the location of the frame as it returns no errors, but it does not seem to want to work. The number on the health bar " 100/100 " changes whenever I lose health, but the bar doesn't want to move/resize. Here is the script I am using to attempt this:
-----
repeat wait() until script.Parent.Parent.Parent.Parent.Character.Humanoid healtha = script.Parent._healthLabel h = script.Parent.Parent.Parent.Parent.Character.Humanoid
while true do healtha.Text = "HP: "..math.floor(h.Health).."/"..math.floor(h.MaxHealth).."" wait(.1) end
function new(health) print("MADE IT 2 FUNC") local bar = script.Parent._health bar.Size = UDim2.new(0, (h.Health/h.MaxHealth)*150, 0, 19) end
function change(health) new(health) end
h.HealthChanged:connect(change)
-----
If you know a solution to this or if you can guide me in a better direction, I would very much appreciated it!
Thank you |
|
|
| Report Abuse |
|
|
|
| 06 Jun 2013 12:18 PM |
| "HealthChanged" is not a valid trigger |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Jun 2013 12:19 PM |
| Just paste the error there |
|
|
| Report Abuse |
|
|
|
| 06 Jun 2013 01:23 PM |
As stated in the OP, no error is returned. It looks fine to me, but something isn't working correctly. I added in the print("MADE IT 2 FUNC") to check if it was even making it to THAT function through the connection, but that doesn't even show either. This means there is something wrong with the connection, but I don't see anything wrong.
|
|
|
| Report Abuse |
|
|
|
| 06 Jun 2013 02:01 PM |
I just found out what the error was, but not sure why it is occurring. The error I get is:
Disconnected event because of exception
I suppose it means there's an error in the connection, but I can't seem to find one. |
|
|
| Report Abuse |
|
|