I’m trying to make a HP and Stamina in billboardgui.
Basically making gui above a character’s head, showing their HP and Stamina.
All characters start off with 300 max hp, and 300 hp, along with stamina.
After using auto-scale lite, it converted everything to scale, and it was perfect so that it will not change size.
What i’m trying to do is make it so I can convert the character’s max hp and hp, stam, etc to the bar.
In the player’s GUI, the bar’s max size on the Y axis is like, 300(Char’s max hp, stam, etc.)
After using auto-scale lite, the HP bar’s max size is 1. Along with stamina.
I need to convert 300 to the bar, so that it will be shown perfectly like a player gui’s stats.
Any help?
I’m not sure what your problem is, it seems you converted 300 to 1 properly?
It’s basically like an HP bar.
You’re trying to make it so that the humanoid’s real HP or MaxHP converts to the bar, where the bar will be shown perfectly.
Let’s say the bar’s max Y axis is 200.
You convert the real HP to 200 using division or whatever, I forgot.
It’ll show perfectly.
In my case, I don’t know how to do this, it’s very problematic since the humanoid’s real HP is 300, and the bars max is like 1.
It would be something along these lines, just take the max size of the bar (1) and multiply it with the current value of the stat divided by the maximum value of the stat.
To put it in perspective lets say we are using health and the max health is 100 and the current health is 50. 50 / 100 = 0.5, and so it would be 1 * 0.5 which is 0.5, and so it would be half the size and it would be displaying half the health.
Bar.Size = Udim2.new(1 * (CurrentStat / MaximumStat), 0, Bar.Size.Y.Scale, 0)
I’ll try it and see if it works.
Assuming it works, if you want a smoother transition between each size change of the bar you can use :TweenSize to achieve that.
Bar:TweenSize(UDim2.new(1 * (CurrentStat / MaximumStat), 0, Bar.Size.Y.Scale, 0), 'Out', 'Quad', 0.15, true)
Eh it’s fine.
The script is updating the values every 1 second, and is already using :TweenSize.
Alright then, glad I could help ![]()