I’m working with bars and such in LUA. At the moment I have a health bar that is fixed width to 15% of the screen width using the code…
local healthBarWidth = ScrW() * 0.15
The actual health of the player is on top of that and is using the code…
local healthBarPlayerHealthWidth = playerHealth * (healthBarWidth / 100)
playerHealth is defined as LocalPlayer():Health()
The only problem with using this method is that when the player has over 100 health it goes off the background bar. I’m trying to find a way of converting the players health into a percentage of 100. So that no matter what the players health is it will always fit into any size.
I’m using an IF block at the moment to check if the players health is over 100 and just limiting the size of the bar to nothing over the width of the fixed background bar.
It would be most appreciated if someone could like me to a tutorial or reference to doing this.
I wouldn’t mind so much but I am going to add some form of experience bar later on that will have all kinds of possible values and it’s going to make my life very complicated when I come to that bridge.
Thanks in advance.
(User was banned for this post ("Undescriptive thread title" - mahalis))