How to make it so you can only see the first decimal in a number?

So I have a script that does stuff with numbers.
And the number can become like:


I want it to only display lets say:


Which would be the first decimal of the number. Anyway to do this?

i haven’t tested this fully, but:

function SingleDecimal(n)
	return math.floor(n * 10) / 10

local Result = SingleDecimal(3.358977707997)
1 Like

This worked first try ngl!

I’d recommend subtracting the remainder of number/0.1 from the number. Remainder can be found with the modulus, so number = number - (number%0.1). Alternatively, if you want to round the number instead of just chopping off the last decimal, you can use this round function I made:

local function round(num, near)
	return (num + near/2) - ((num + near/2) % near)

Edit: solved right as I replied.

1 Like