local stopwatch = script.Parent -- parent of the script (should be a gui)
local seconds = 0 -- the value of seconds
local minutes = 0 -- the value of minutes
local hours = 0 -- the value of hours
while wait(1) do -- every second it does the underneath until the final end (keeps repeating)
seconds += 1 -- adds one to the seconds value
if seconds >= 60 then
seconds -= 60
minutes += 1 -- if the seconds value is one it subtracts by 60 to make the value 0 and adds 1 to the value of minutes
end
if minutes >= 60 then
minutes -= 60
hours += 1 -- if the minutes value is 60 then it subtracts by 60 to make the value 0 and adds 1 to the value of hours
end
stopwatch.Text = hours..":"..minutes..":"..seconds -- displays the values if seconds, minutes, and hours
end