generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Making a timer that goes 1:00 instead of 60

Previous Thread :: Next Thread 
Badfitz100 is not online. Badfitz100
Joined: 03 Nov 2010
Total Posts: 12591
31 Oct 2014 02:50 PM
I had one in one of my old places, couldn't find it stored on my computer and the old place is on a deleted account.

Basically what I want is a simple timer that coverts the generic '60' to '1:00'

Hibachi Man makes his daring escape, The Barbecue Belly Slide!
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
31 Oct 2014 02:55 PM
minutes = 0
seconds = 55
while true do
wait(1)
seconds = seconds + 1
if seconds >= 60 then
minutes = minutes + 1
seconds = 0
end
print(minutes..":"..seconds)
end

you could also use modulus on the seconds to get the minutes but it's probably just easier to do it this way.
Report Abuse
Badfitz100 is not online. Badfitz100
Joined: 03 Nov 2010
Total Posts: 12591
31 Oct 2014 02:57 PM
want it in a for loop, thanks anyway.

Hibachi Man makes his daring escape, The Barbecue Belly Slide!
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
31 Oct 2014 02:59 PM
that's a good time to use modulus then I think
for i = 55, 120 do
print((i%60)..math.floor(i/60))
end

try that
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
31 Oct 2014 03:01 PM
local seconds = 60
local minutes = math.floor(seconds/60)

Yes. It's that easy. lol

~The herp lerped a derp~
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
31 Oct 2014 03:01 PM
Switched them up :P
for i = 55, 120 do
wait(1)
print(math.floor(i/60).." "..(i%60))
end
Report Abuse
Badfitz100 is not online. Badfitz100
Joined: 03 Nov 2010
Total Posts: 12591
31 Oct 2014 03:05 PM
when it get's to a point where it's supposed to be 1:00, it's 1:0

Hibachi Man makes his daring escape, The Barbecue Belly Slide!
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
31 Oct 2014 03:07 PM
then add an if statement
if i % 60 < 10
print with extra 0
else
print reg
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
31 Oct 2014 03:30 PM
local function FormatSecondsToTime(s)
local minutes = math.floor(s/60)
local sec = s%60
return (minutes > 9 and minutes or '0'..minutes)..':'..(sec < 10 and '0'..sec or sec)
end
Report Abuse
noah is not online. noah
Joined: 11 Sep 2006
Total Posts: 18977
31 Oct 2014 03:43 PM
FormatTime = function(time)
return ("%2i:%.2i"):format((time/60)%60, time%60)
end

for i = 60, 0, -1 do
wait(1)
print(FormatTime(i))
end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image