A simple round function

I would just like you to tell me if there is an easier way as this is the best I could do.

local Math = {}

Math.Round = function(Number, Number2)
	return math.round(Number / Number2) * Number2
end

return Math

I think that is the easiest and only way. If I’m correct, you are trying to round decimal places?

1 Like

Wait, since when does math.round exists?

Do you want to round the decimals or

math.floor({number} + 0.5)

Replace ā€œ{number}ā€ with the variable you want to round,

This function will round a number if it is bigger than 0.5 then up and less than 0.5 then down

This does decimals and whole numbers. It can round 10 to nearest hundreds and .1 to nearest whole

Thats just decimals. Not whole numbers