Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Stop Health Appearing As A Decimal Value?

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!

1 comment

0

You should look up "Formatting decimal numbers in Lua".

2 answers

✓ Accepted answer

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)

1 comment

0

Thanks, i forgot math.floor existed.

This discussion is preserved as it was. New answers, comments, and votes are closed.