Healthbar not working

I only noticed cause I tested it lol, probably wouldn’t of noticed it otherwise.

1 Like

I’ve edited the script you can copy and paste that if you want. It should be working and if it doesn’t work just add prints.

I already changed it, but I found an error in the output

  17:23:26.276  Players.Berrinlin.PlayerGui.ScreenGui.In-GameScreen.Health.HealthBar.LocalScript:12: attempt to index nil with 'HealthChanged'  -  Client - LocalScript:12

Could somebody explain this error?

I changed the local Humanoid line to :WaitForChild() so you can try that. It should fix the error.

This worked! Thank you so much for helping me out!

1 Like

No problem, I would recommend learning what the errors mean so you can debug yourself it’s very useful to learn. In this case Humanoid was nil since I used :FindFirstChild() and that could’ve meant that the humanoid didn’t exist at the time, so when it tried to get the HealthChanged it errored. Using :WaitForChild() waited until the Humanoid Existed. Hope that clears the error up. Have a good day!