I can’t find anything about rounding

```
game.Players.LocalPlayer.Character:WaitForChild("Humanoid").HealthChanged:Connect(function(n)
script.Parent.Text = "Health: ".. game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Health
end)
```

I have a script that shows your health on a gui but when the player regens it goes like 99.3453694573
and it’s pretty annoying so im tryna round to nearest whole

use math.floor. It does what u want

```
script.Parent.Text = "Health: ".. math.floor(game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Health
end))
```

If you have any questions then feel free to ask

Scottifly
(Scottifly)
December 2, 2021, 11:08pm
#3
Do what @kinglol123468 mentioned, but use math.round since it rounds to the nearest whole #, so 5.6 will round to 6 .
math.floor will take 5.6 and drop it to 5 .

1 Like

you could do both. But i just used math.floor

D0RYU
(nici)
December 2, 2021, 11:49pm
#5
```
print(math.round(Number))
print(math.floor(Number + 0.5))
```

I recommend using math.round, it was made for this thing
you could use math.ceil, but it wouldn’t be that good

```
function Round(Number)
Number -= 0.5
return math.ceil(Number % 1 == 0 and Number + 1 or Number)
end
```

please don’t use that function

Scottifly
(Scottifly)
December 3, 2021, 12:08am
#6
But for accuracy you should use math.round as I and @D0RYU mentioned.

math.floor will take every value from (for example) 2.000000 up to 2.999999 and make it 2.

math.round will take every value from 2 up to 2.49999999 and make it 2, while everything from 2.5 up to 3 will be made 3.

1 Like

Ripxff
(bhdb)
December 3, 2021, 12:14am
#8
math.ciel , you always wanna round float to int up especially considering health, sorry @Scottifly i replied to the wrong dude mb

I didn’t know that. Though im still going to use math.floor so it just deletes the decimals. I dont need it to round.

Scottifly
(Scottifly)
December 3, 2021, 12:21am
#10
But @cookthedev asked for something that rounds to the nearest integer which math.floor doesn’t do.

From the math | Roblox Creator Documentation page:
math.round Returns the integer …
An integer has no decimal.

Try it out.

1 Like

I was talking about myself. Not about him.

D0RYU
(nici)
December 3, 2021, 12:25am
#12

kinglol123468:

I dont need it to round.

math.ceil, math.floor, and math.round remove all the decimals/fractions

Look here loloololol
^^^^^^^^^^