Round

Rounds a number to the highest closest number, allows to add decimals

Arguments

Label
Explained
Type
Example

value

The value to round

number

20.1234

decimalPlaces

The amount of decimals to have (optional)

number

2

Why not just use math.round?

This function adds .5 to the value (if decimalPlaces isn't provided) so it gets rounded to the nearest biggest number

How does decimalPlaces work?

You provide a number of decimal places that you would like the function to return, here's an example

local value = 525.1885

print(Math.Round(value)) -- 526
print(Math.Round(value, 2)) -- 525.19

Last updated