|
| 17 May 2014 02:41 PM |
How would I make a countdown TextLabel? Would I use:
player.PlayerGui.ScreenGui.TextLabel.Text = tonumber(player.PlayerGui.ScreenGui.TextLabel.Text)-1
?? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 May 2014 02:44 PM |
for i = start, 1, -1 do local hr = math.floor(i / 3600); local mn = math.floor(i / 60) % 60; local sc = i % 60; player.PlayerGui.ScreenGui.TextLabel.Text = hr .. ":" .. mn .. ":" .. sc; wait(1); end |
|
|
| Report Abuse |
|
|
|
| 17 May 2014 02:44 PM |
I would use a for loop. for i = 20,0,-1 do player.PlayerGui.ScreenGui.TextLabel.Text = i end |
|
|
| Report Abuse |
|
|
ohno1112
|
  |
| Joined: 23 Mar 2013 |
| Total Posts: 833 |
|
|
| 17 May 2014 02:47 PM |
a = 30 -- Change to how long it should countdown b = player.PlayerGui.ScreenGui.TextLabel.Text
for i = 1, 30 do --change 30 to the amount of seconds too. b = ""..a a = a - 1 wait(1) end --Code After Countdown here.
|
|
|
| Report Abuse |
|
|
|
| 17 May 2014 02:50 PM |
You saw my thread? This method is easily understandable, and very affective.
local TextLbl = script.Parent local Minutes = 1 local Seconds = 0 for i = 1, Minutes + 1 do for i = 1, Seconds + 1 do if Seconds < 10 then TextLbl.Text = "Countdown: "..Minutes..":0"..Seconds else TextLbl.Text = "Countdown: "..Minutes..":"..Seconds end Seconds = Seconds - 1 wait(1) end Seconds = 59 Minutes = Minutes - 1 end |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
| |
|
|
| 17 May 2014 02:54 PM |
@128, That countdown is a basic countdown method used for games like lando's hide and seek, and twoshue's freeze tag/hide and seek. You should be saying ew to
for i = 120, 1, -1 do h.Text = "Countdown: "..i wait(1) end
^ That can be a sloppy countdown if it's more than a minute. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 May 2014 02:54 PM |
| Mine handles them all efficiently and shortly |
|
|
| Report Abuse |
|
|
|
| 17 May 2014 02:56 PM |
| I tested yours and it doesn't even work ;/ |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 May 2014 02:59 PM |
| start is how many seconds to start with. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 May 2014 03:00 PM |
| How does it not work? The chances of me messing up on something that simple is basically 0 |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 17 May 2014 03:57 PM |
@Cnt It does work, but it does this 0:1:1
Instead of 0:01:01
Here is something I made a few weeks ago
(Model) http://www.roblox.com/Function-clock-string-item?id=155213345 (Script)
local clock = { ["string"] = function(Time) return tostring(math.floor(Time / 60)) .. ":" .. (#tostring(Time % 60) == 1 and "0" .. tostring(Time % 60) or tostring(Time % 60)) end, ["minutes"] = function(Time) return math.floor(Time / 60) end, ["seconds"] = function(Time) return (Time % 60) end }
-------------- --{Examples}-- --------------
for x = 120, 0, -1 do print(clock.string(x)) wait(1) end
print(clock.minutes(60)) --> 1, there is one minute in 60 seconds print(clock.seconds(60)) --> 0, because 60 seconds is 1:00 on a clock print(clock.seconds(61)) --> 1, because 61 seconds is 1:01 on a clock |
|
|
| Report Abuse |
|
|
|
| 17 May 2014 04:56 PM |
| Guys, I already am using a for loop... I really just need a timer for seconds left.. How can I have the TextLabel's text correspond to how many times the for loop has left to run? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 May 2014 05:21 PM |
hr < 10 and "0" .. hr or hr Not hard. |
|
|
| Report Abuse |
|
|
|
| 17 May 2014 06:05 PM |
It's really easy... if --something then for i=1,20--whatever you want do element.Text = element.Text - 1 wait(1) end else return end |
|
|
| Report Abuse |
|
|
|
| 17 May 2014 10:25 PM |
| Nevermind guys, my first post worked... |
|
|
| Report Abuse |
|
|