letiul
(lettuce)
March 31, 2022, 8:03pm
#1
Hello! im trying to do a healthbar that goes up when you get damaged and goes down when you get healed, but i tried a bunch of formulas and none worked, im using TweenSize for the gui.
What i actually want
A formula with UDim2 that makes that what i wanted above.
Mystxry12
(Mystxry)
March 31, 2022, 8:17pm
#2
Udim2.fromScale(GUI.SIZE.X, CURRENT_HP / TOTAL_HP)
Ready2XD
(Ready)
March 31, 2022, 8:33pm
#3
Maybe try something like this
local reversedHealth = -(Health/MaxHeakth)
Udim2.new(Bar.Size.X, reversedHealth, Bar.Size.Y.Offset, Bar.Size.Y.Scale)
letiul
(lettuce)
March 31, 2022, 8:47pm
#4
quick question GUI is the bar?
Ready2XD
(Ready)
March 31, 2022, 8:50pm
#5
Yes It’s the bar I just edited it right now.
letiul
(lettuce)
March 31, 2022, 8:57pm
#6
didn’t work
my code:
Health.Inner:TweenSize(UDim2.new(0, -(Humanoid.Health/Humanoid.MaxHealth), 0, 30), Enum.EasingDirection.In, Enum.EasingStyle.Quad, 0.35, true)
Shamplify
(Shamplift)
March 31, 2022, 11:41pm
#7
Just subtract the health percentage from 1. This would make 75% health result in 25% of the bar to be filled, and so on.
local hum
UDim2.fromScale(1 - (hum.Health/hum.MaxHealth), size.Y)