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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How do I make a timer?

Previous Thread :: Next Thread 
Twistir is not online. Twistir
Joined: 19 Nov 2009
Total Posts: 12374
11 Jan 2015 12:15 PM
One that looks like this:
2:00

My friend said to use string manipulation so I went to the wiki page and there are a bijillion of them, what do I do?
Report Abuse
Twistir is not online. Twistir
Joined: 19 Nov 2009
Total Posts: 12374
11 Jan 2015 01:21 PM
bump
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
11 Jan 2015 01:32 PM
So like it starts from 2:00 and goes down to 0:00?
There really is no string manipulation involved.
Report Abuse
Twistir is not online. Twistir
Joined: 19 Nov 2009
Total Posts: 12374
11 Jan 2015 02:53 PM
then what do I do?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
11 Jan 2015 02:56 PM
local seconds = 2 * 60;

for second = seconds, 1, -1 do
local min = math.floor(second / 60);
local sec = second % 60;
print(min .. ":" .. sec);
wait(1);
end
Report Abuse
parkiet3 is not online. parkiet3
Joined: 16 Jul 2011
Total Posts: 832
11 Jan 2015 03:22 PM
Or you use tick() or you use runservice
Report Abuse
Twistir is not online. Twistir
Joined: 19 Nov 2009
Total Posts: 12374
11 Jan 2015 03:30 PM
thank you
Report Abuse
parkiet3 is not online. parkiet3
Joined: 16 Jul 2011
Total Posts: 832
11 Jan 2015 03:33 PM
I would recommend the runservice, this will be the easiest, dont use the script above, make your pc lag enormeous and your timer would tick a lot slower
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
11 Jan 2015 03:33 PM
use string.format() to make it take less lines and look prettier
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
11 Jan 2015 03:36 PM
It'll take the same amount of lines dud
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
11 Jan 2015 03:37 PM
"It'll take the same amount of lines dud"

no you can get rid of assigning a variable to minutes and a variable to seconds
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
11 Jan 2015 03:38 PM
You'll have to do the math either way...
print((math.floor(second / 60)) .. ":" .. (second % 60));

1 line.
Report Abuse
parkiet3 is not online. parkiet3
Joined: 16 Jul 2011
Total Posts: 832
11 Jan 2015 03:43 PM
local steps = 0
local countdown = 180 -- time in seconds

game:GetService("RunService").Stepped:connect(function()
steps = steps+1
if steps%30 == 0 then --iterates every second
text = tostring(math.floor(countdown/60))..tostring(countdown%60)
countdown=countdown-1
end

end)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
11 Jan 2015 03:44 PM
oh my god the inefficiency is real
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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