Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Stop Health Appearing As A Decimal Value?

Asked by 3 years ago

Hello fellow developers, I'm facing an issue where my GUI isn't working as intended due to how Roblox health system works. When the player starts to regenerate, the players health turns into a mess of a long decimal... > https://gyazo.com/107396e5eac96b743825891931b7cb6d <

Is there any way to make it so health appears as a normal, 2-3 digit number like this? > https://gyazo.com/8cbfd4ab615981de755ddfd33f942162 <

Please respond if you know the answer, i cant find it on the web and this is my last resort. Thanks!

0
You should look up "Formatting decimal numbers in Lua". Desmondo1 121 — 3y

2 answers

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

You simply just need to floor player's heath, using math.floor() function, with something like this:

--HealthBar is the text labe, for example
HealthBar.Text = math.floor(Character.Huamanoid.Heath).."/"..math.floor(Character.Humanoid.MaxHealth)
0
Thanks, i forgot math.floor existed. fakedantdm1000 30 — 3y
Ad
Log in to vote
0
Answered by 3 years ago
print(math.floor(number))

Answer this question