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/hum.MaxHealth - 0.368, 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 local script controls the health bar, This is the layout:
It works well but the length of the healthbar isnt equal to my health. Like whenever my health is 10 the healthbar falls into negative numbers and looks like this:
How do I stop this from happening? (the original length of the health bar is {0, 700},{0, 35})