Decimals weirdly going to a bunch of nines?

So I was making a timer script for a typing game, but I have this really weird issue. The timer is acting really weirdly. Once you get about 10 seconds in, it has a bunch of unnecessary nines at the end. Can anybody explain why?

Local Script for Timer
local seconds = 30
script.Parent.TimerGoing.Changed:Connect(function()
	while true do
		script.Parent.Text = tostring(seconds)
		seconds-=.01
		wait(.01)
	end
end)

File:decimals.rbxl (27.0 KB)

1 Like

Can you provide a screenshot of your issue rather than a place file?

1 Like

Try using math.floor. It narrows down the number by a lot.

I was trying to have the decimals be visible, though.

How many decimals in the number?

Just the tenths and hundredths.

Could you provide a screenshot/video of what happens?

I’m currently using a computer that’s not mine. I can explain it, though. Once it gets to a number divisible by 10, it has the normal tenths and hundredths, but then has either 0000000001 or 999999999

and then 1 in 00000001 goes up over time. For example, it goes to 0000000002

Number of zeroes and nines not exact lol

Do you know any math functions that can round numbers down to specific decimal places?

Something like this could work. Math.floor would be the solution here, you just have to modify it a bit. How to math.floor to a decimal in Lua? - Stack Overflow

Easy! Just put in the number/variable you want to round, multiply by 20 then divide by 20!

e.g.

print(math.floor(12.5928 * 20) / 20)

Output:
12.55

1 Like

I agree with the link you posted but I don’t agree with

I replaced the 20s with 100s, meaning the hundredths place, as stated from the link you shared.

1 Like

What output did you get from replacing it with 100?

It rounds to the hundredths place, like I wanted.

1 Like

You should use 10, 100, etc. to move the decimal.

1 Like

I’m not entirely sure about what you mean by this, could you explain?

Also just now I realized that this isn’t functioning as I wanted it to. It’s counting each tenths place number as 1 second.