How to remove the second/third value of a number?

Ok so, let’s say we have a random number generator.
The RNG picked 56
(Please don’t tell me to do 56 - 6, it’s not what I need)
How would I remove the ‘6’ to become 50
It is a random number each time.

Ok so, let’s say we have another random number generator.
The RNG picked 129

How would I remove the 9? So it can become 120

Help is appreciated!

local number = [however you generate numbers] -- Example: 99
number = number/10 -- Divide by ten, you get 9.9
math.floor(number) -- Round down, and you get 9
number = number*10 -- Multiply by 10 again, and you get 90
1 Like
math.floor(number / 10) * 10

This will round it to the lowest tenth, if u want to do it to the lowest hundredth or more just replace the 10 with 100, 1000 and so on.

1 Like