wait(.5)
game:GetService("StarterGui"):SetCoreGuiEnabled("Health", false)
plr = game.Players.LocalPlayer
chr = plr.Character
hum = chr.Humanoid
sp = script.Parent
bar = sp.Bar
hbar = bar.Health
while wait(.001) do
hbar.Size = UDim2.new(hum.Health + 650 - 0, 0, 0, 35)
if hum.Health<=20 then
hbar.BackgroundColor3=Color3.new(255/255, 0, 0)
else hbar.BackgroundColor3=Color3.new(0, 255/255, 0)
end
end
hubar = bar.Hunger
This is my current healthbar script, its really buggy and I have no idea how to fix it, so is there any other way to make a health bar other than the method I used, and if not could you fix this for me?

4 comments
Use Hum.Changed:connect(function() .....
Have the bar's scale be from 0 to 1. So you would just use Health/MaxHealth. This is a duplicate question I tried explaining this to you.
I asked you to put it in the form of an answer because it did not understand it that well.
If you didn't understand it well, keep asking questions. We don't give out answers. We provide ways to accomplish your task. The 0-1 scale can be used with their health. 100/100 = 1. 90/100 = .9. Keep changing their size, by dividing their health by 100.