#HealthBar not working

1 messages · Page 1 of 1 (latest)

dusk tinsel
#

I got a health bar ill send pictures and code in a sec

#
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local Healthbar = Player.PlayerGui.StatsBar.HealthFrame


local function UpdateHealthbar()
    local health = math.clamp(Humanoid.Health / Humanoid.MaxHealth, 0, 1)
    Healthbar.Size = UDim2.fromScale(400*health, 30)
end

UpdateHealthbar()

Humanoid:GetPropertyChangedSignal("Health"):Connect(UpdateHealthbar)
Humanoid:GetPropertyChangedSignal("MaxHealth"):Connect(UpdateHealthbar)
#

This is how it looks when I join the game

#

This is how it supposed to look normally

analog thorn
#

(but your healthbar not being parented to the frame, does tell it probably isn't (should've looked at this sooner), either set it up so they're parented to eachother, or just try to set them up in the exact same way, and refactor the previous formula with the default scales of the healthbar (scale, not offset)

dusk tinsel
#

Alright

#

Thanks

#

I set it up like this, still doesn't work

dusk tinsel
hidden moss
#

To make health bars and other bars

dusk tinsel
hidden moss
dusk tinsel