For a game I'm trying to develop, I am trying to make a functional clock at the top of the screen. There are 3 different Text labels to adjust the minutes, and 2 digits for the seconds. When running, whenever the clock hits a flat 10 value in the seconds section the 10 will remain on the first digit. For example, if the time were to be going 6:42, 6:41 to 6:40, it would instead show 6:3 10. I am using this script with a NumValue in ReplicatedStorage. What should I go about doing to make sure the last digit never becomes a flat out 10 and to revert ten back to the 2nd digit?
local TimerValue = game.ReplicatedStorage.TimerValue.Value -- script.Parent.Seconds.Text = print(ThirdDigitFinal) Stored code for later if script.Parent.Seconds2.Text == 10 then script.Parent.Seconds2.Text = 0 end while TimerValue > 0 do wait(1) TimerValue = TimerValue - 1 game.ReplicatedStorage.TimerValue.Value = TimerValue - 1 local TimerValue = game.ReplicatedStorage.TimerValue.Value local MinutesRough = game.ReplicatedStorage.TimerValue.Value/60 local Minutes = tostring(math.floor(MinutesRough)) local SecondsDecimated = MinutesRough - Minutes local Seconds = SecondsDecimated * 60 local Seconds2nd = tostring(math.floor(Seconds/10)) local Seconds3rd = Seconds/10 local ThirdDigit = Seconds3rd - Seconds2nd local ThirdDigitFin = ThirdDigit * 10 local ThirdDigitFinal = tostring(math.ceil(ThirdDigitFin)) script.Parent.Seconds2.Text = ThirdDigitFinal script.Parent.Minute.Text = Minutes script.Parent.Seconds.Text = Seconds2nd print(ThirdDigitFinal) end