Remove decimals at the end of number?

Suppose the number is 18.9999, how would I make that number into an 18 in a script/how would I remove all decimals?

This can easily be done by using math.floor()

local Number = 18.78679456656854765
local b = math.floor(Number)
print(b)
1 Like
math.floor(18.9999)

math.floor returns the lowest Value, math.ceil returns the Highest

local Number = 18.9999
local RoundLow = math.floor(Number) -- 18
local RoundHigh = math.ceil(Number) -- 19

print(RoundLow, RoundHigh) -- "18 19"

A more useless Example:

local Round = -math.round(Number)+ math.floor(Number * 2)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.