|
| 02 Oct 2016 10:30 PM |
I want to make a timer in my shop GUI like a limited time offer that counts down a time, the time I want to use is "23:59:00" with the : in it, but it won't countdown because the : is not acceptable.
But when I remove the : the script works.. :/
|
|
|
| Report Abuse |
|
|
|
| 02 Oct 2016 10:32 PM |
for seconds = 666, 0, -1 do print(string.format("%.2d:%.2d:%.2d", math.floor(seconds/3600)%24, math.floor(seconds/60)%60, seconds%60)) wait(1) end |
|
|
| Report Abuse |
|
|
Bit_blox
|
  |
| Joined: 28 Aug 2016 |
| Total Posts: 974 |
|
|
| 02 Oct 2016 10:33 PM |
make 5 guis
layout:
Hours|:|Minutes|:|Seconds
| used to represent individual text labels
make sure to put the outline to 0 (transparent)
|
|
|
| Report Abuse |
|
|
| |
|
|
| 02 Oct 2016 10:36 PM |
because then I would need 3 separate scripts, and wouldn't they all be counting down..
|
|
|
| Report Abuse |
|
|
|
| 02 Oct 2016 10:38 PM |
"because then I would need 3 separate scripts, and wouldn't they all be counting down.."
This is hilarious. |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2016 10:40 PM |
um..I'm not very good with scripting, so go ahead and laugh.
|
|
|
| Report Abuse |
|
|
|
| 02 Oct 2016 10:42 PM |
| You can manage all three objects from one script, even I knew that when I started scripting. I guess everyone is different though. |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2016 10:44 PM |
Could you make one for me? If not, it's fine.
|
|
|
| Report Abuse |
|
|
|
| 02 Oct 2016 10:48 PM |
I never liked making things for people unless I was paid or if they would learn something from it. If I gave you a script you wouldn't learn from it and would instead just copy/paste it. So I give you this challenge: Learn how to control objects in scripts, the Lua string patterns and finally basic Lua.
http://wiki.roblox.com/index.php?title=Intro_to_Scripting http://wiki.roblox.com/index.php?title=String_pattern |
|
|
| Report Abuse |
|
|
| |
|
Bit_blox
|
  |
| Joined: 28 Aug 2016 |
| Total Posts: 974 |
|
|
| 02 Oct 2016 10:53 PM |
local seconds = 59 local minutes = 59 local hours = 24
while true do seconds = seconds - 1 wait(1) if seconds == 0 then minutes = minutes - 1 seconds = 59 if minutes = 0 then hours = hours - 1 minutes = 59 seconds = 59 if hours == 0 then hours = 0 minutes = 0 seconds = 0 script.Disabled = true end end end end
its really crappy and starts over when you die, but im just trying to give you a step in the right direction.
|
|
|
| Report Abuse |
|
|
|
| 02 Oct 2016 11:48 PM |
'string.format("%.2d:%.2d:%.2d", min, sec, millisec)'
use that
it works because it will format the numbers into 2 integer digits and then place a colon
|
|
|
| Report Abuse |
|
|
|
| 02 Oct 2016 11:52 PM |
and you can just convert secs and count down from that using standard division and flooring it
example: secs to mins:
print(math.floor(60/60)) > 1 print(math.floor(30/60)) > 0 print(math.floor(120/60)) > 2 |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2016 11:53 PM |
Make sure that the seconds you are formatting though are:
seconds%60
use modulo to make sure that it never goes over that number but returns the remainder in division |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2016 11:55 PM |
| and also use modulo on the mins and hours too which flux did so that it does not go over 60 or 24 |
|
|
| Report Abuse |
|
|