#HealthBar Issue

1 messages · Page 1 of 1 (latest)

tawny needle
#
local Frame = script.Parent

local Text = Frame.Parent.HealthTextFrame.TextLabel

local Player = game.Players.LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()

local Humanoid = Character:WaitForChild("Humanoid")

Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
    local HealtPercent = Humanoid.Health / Humanoid.MaxHealth
    
    Frame.Size = UDim2.new(HealtPercent,0, 0, 0)
    
    Text.Text = tostring(math.floor(Humanoid.Health))
end)
warm plank
#

Since you set the frame.Size to like 100, 0, 0, 0 you won't able to see it.

tawny needle
#

what should i do?

sweet scarab
warm plank
#

do somethings like this

Frame.Size = UDim2.new(health, 0, Frame.Size.Y.Scale, Frame.Size.Y.Offset)

sweet scarab
#

try

tawny needle
sweet scarab
tawny needle
#

both

muted helmBOT
#

studio** You are now Level 6! **studio

sweet scarab
#

Then it must be how the bar is made -_- , if it is scaled and it doesnt occupy the whole frame then do this :
Frame.Size = Udim2.new(HealtPercent,0,1,0)

#

ok let me fix

warm plank
#

Yea, like GabiL said, its a isseus with how you made the frame then

sweet scarab
#

Try using a math.clamp thing

tawny needle
#

i have to do frame again?

#

wait

warm plank
#

How is your frame build?

sweet scarab
tawny needle
#

it has constraint and UIcorner

sweet scarab
tawny needle
sweet scarab
#

Or else it aint goint to work

tawny needle
#

uhh

#

wait

#

let me uh

#

just

#

do

sweet scarab
#

Delete the constraint

warm plank
#

Do you have somethings like this:

  • Screengui

  • Frame

  • Healthbar (frame)
    Or its it like

  • Screengui

  • Healthbar (Frame)

tawny needle
#

second

sweet scarab
warm plank
#

Yea make sense then

#

You need to make like first

tawny needle
#

domain expansion

sweet scarab
tawny needle
#

k

sweet scarab
#

HealthBar size must be 1,0,1,0

#

I will go now

#

Good luck

tawny needle
#

fixed

#

thanks guys

#

hold up

#

i have to redo the frames

#

lets go it works

#

thanks guys