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: Countdown?

Previous Thread :: Next Thread 
DeSpizer27 is not online. DeSpizer27
Joined: 13 Jul 2012
Total Posts: 2679
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 is not online. 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
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
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 is not online. 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
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
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 is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
17 May 2014 02:51 PM
meh
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
17 May 2014 02:52 PM
@Acco
Ew no
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
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 is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
17 May 2014 02:54 PM
Mine handles them all efficiently and shortly
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
17 May 2014 02:56 PM
I tested yours and it doesn't even work ;/
Report Abuse
cntkillme is not online. 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 is not online. 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 is not online. 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
DeSpizer27 is not online. DeSpizer27
Joined: 13 Jul 2012
Total Posts: 2679
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 is not online. 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
DenialOfRetribution is not online. DenialOfRetribution
Joined: 02 May 2014
Total Posts: 166
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
DeSpizer27 is not online. DeSpizer27
Joined: 13 Jul 2012
Total Posts: 2679
17 May 2014 10:25 PM
Nevermind guys, my first post worked...
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