I've been trying to make a stopwatch for an obby game of mine, which times you as you complete it. When the stopwatch reaches 10 however, it breaks and say "00:010" instead of "00:10" like its suppose to. If anyone could help, that would be great.
Its inside a local script with its parent being a textlabel.
local startmin = 0 local startsec = 0 local text = script.Parent local min = 0 local sec = 0 while true do startsec = startsec + 1 print("Added 1 sec") if startsec == 60 then startsec = 0 startmin = 1 end if sec > 9 then local mess = "0" .. startmin .. ":" .. startsec text.Text = mess else local mess = "0" .. startmin .. ":0" .. startsec text.Text = mess end wait(1) end
Because you are not changing the variable 'sec' anywhere in your script, so it always shows a 0 before each number. make sure after every second in your while loop, you put sec=sec+1. Also ensure that startmin when you are using it is startmin+1 where you have put in the while loop, otherwise is will always show startmin's value as 1.