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
|
  |
| Joined: 19 Nov 2009 |
| Total Posts: 12374 |
|
| |
|
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
|
  |
| Joined: 19 Nov 2009 |
| Total Posts: 12374 |
|
| |
|
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
|
  |
| Joined: 16 Jul 2011 |
| Total Posts: 832 |
|
|
| 11 Jan 2015 03:22 PM |
| Or you use tick() or you use runservice |
|
|
| Report Abuse |
|
|
Twistir
|
  |
| Joined: 19 Nov 2009 |
| Total Posts: 12374 |
|
| |
|
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 |
|
|
|
| 11 Jan 2015 03:33 PM |
| use string.format() to make it take less lines and look prettier |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 11 Jan 2015 03:44 PM |
| oh my god the inefficiency is real |
|
|
| Report Abuse |
|
|