Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Whats the best way to make a Health Bar?

Asked by
neoG457 315 Moderation Voter
8 years ago
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?

0
Use Hum.Changed:connect(function() ..... Validark 1580 — 8y
0
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. M39a9am3R 3210 — 8y
0
I asked you to put it in the form of an answer because it did not understand it that well. neoG457 315 — 8y
0
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. Shawnyg 4330 — 8y

Answer this question