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: Is there a simple way to make a countdown?

Previous Thread :: Next Thread 
call23re is not online. call23re
Joined: 11 Nov 2010
Total Posts: 9070
22 Dec 2013 10:49 PM
I don't want to make the text change for every second manually. I've done it a lot more simple before just I'm tired and can't think about how I did it.

a = Instance.new("Hint",Workspace)
a.Text = "60 seconds left"
wait(1)
a.Text = "59 seconds left"
wait(1)
a.Text = "58 seconds left"
wait(1)
a.Text = "57 seconds left"
wait(1)
a.Text = "56 seconds left"

and so on



-"The wise never quote."
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Dec 2013 10:50 PM
a = Instance.new("Hint", Workspace)
for i = 60, 1, -1 do
a.Text = i .. " seconds left"
wait(1)
end
Report Abuse
call23re is not online. call23re
Joined: 11 Nov 2010
Total Posts: 9070
22 Dec 2013 10:50 PM
thanks



-"The wise never quote."
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
22 Dec 2013 10:52 PM
local min = 1 --Minutes
local sec = 0 --Seconds
local mic = 0 --Millaseconds

h = Instance.new("Hint")
h.Parent = script

while true do
mic = mic - 2
if mic <= -1 then
sec = sec - 1
mic = 59
if sec == -1 then
min = min - 1
sec = 59
if min == -1 then
min = 0
sec = 0
mic = 0
end
end
end
if min <= 9 and sec <= 9 and mic <= 9 then
h.Text = "0" ..min.. ":0" ..sec..":0" ..mic
elseif min <= 9 and sec <= 9 and mic >= 10 then
h.Text = "0" ..min.. ":0" ..sec..":" ..mic
elseif min <= 9 and sec >= 10 and mic <= 9 then
h.Text = "0" ..min.. ":" ..sec..":0" ..mic
elseif min <= 9 and sec >= 10 and mic >= 10 then
h.Text = "0" ..min.. ":" ..sec..":" ..mic
elseif min >= 10 and sec <= 9 and mic <= 9 then
h.Text = min.. ":0" ..sec..":0" ..mic
elseif min >= 10 and sec <= 9 and mic >= 10 then
h.Text = min.. ":0" ..sec..":" ..mic
elseif min >= 10 and sec >= 10 and mic <= 9 then
h.Text = min.. ":" ..sec..":0" ..mic
elseif min >= 10 and sec >= 10 and mic >= 10 then
h.Text = min.. ":" ..sec..":" ..mic
end
wait()
end
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
22 Dec 2013 10:53 PM
Lol SIMPLE!!!! and I was bored, don't judge.
Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
22 Dec 2013 10:53 PM
a = Instance.new("Hint", Workspace)
for i = 1, 60, 1 do
a.Text = (60-i) .. " seconds left"
wait(1)
end
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Dec 2013 10:56 PM
Goul, why did you just upload that disgusting code (no offense)
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
22 Dec 2013 10:58 PM
Discusting..? It's accurate, just the functions are complex there was a simple Minutes, Seconds, Millaseconds spot for the user. Sorry for over achieving?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Dec 2013 11:00 PM
Um, no not really.
Your way is pretty bad (like I said, no offense)

You could just do

sec = 0

local seconds, minutes, hours

while wait(1) do
sec = sec + 1
seconds = math.floor(sec % 60)
minutes = math.floor(sec / 60) % 60
hours = math.floor(sec / 3600) % 24
end
Report Abuse
Madified is not online. Madified
Joined: 19 Apr 2011
Total Posts: 5292
22 Dec 2013 11:00 PM
[ Content Deleted ]
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
22 Dec 2013 11:04 PM
Oh my god sorry for making a working script that didn't meet your expectations.
Report Abuse
Madified is not online. Madified
Joined: 19 Apr 2011
Total Posts: 5292
22 Dec 2013 11:04 PM
[ Content Deleted ]
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Dec 2013 11:05 PM
That's not what I'm saying, I'm saying that if you are going to make a long script, at least have the courtesy to tell him what it does, throwing it out there is not going to help him, and he doesn't even want the time in HMS (or so he didn't ask)
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
22 Dec 2013 11:09 PM
Re-

local min = 1 --Minutes
local sec = 0 --Seconds
local mic = 0 --Millaseconds

._.

I explained enough for a beginner scripter to understand.

._.

This conversation is over

._.

*facetrain*

._.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Dec 2013 11:10 PM
You're just making yourself look bad.
I'm not talking about that, I'm talking about the overall feel, and yes I obviously know what it does but I'm telling you if you're going to give him stuff he didn't ask for, at least explain it to HIM
Report Abuse
call23re is not online. call23re
Joined: 11 Nov 2010
Total Posts: 9070
22 Dec 2013 11:45 PM
wait this isn't working
it's not counting down,instead it just removes instantly so I tried to change the wait to 60 seconds instead and the hint doesn't change it just says 60 seconds left for the whole thing



-"The wise never quote."
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Dec 2013 11:50 PM
Which are you using?

"a = Instance.new("Hint", Workspace)
for i = 60, 1, -1 do
a.Text = i .. " seconds left"
wait(1)
end"

This one?
Report Abuse
call23re is not online. call23re
Joined: 11 Nov 2010
Total Posts: 9070
22 Dec 2013 11:54 PM
yeah but I have a:remove() before it ends

a = Instance.new("Hint", Workspace)
for i = 60, 1, -1 do
a.Text = i .. " seconds left"
wait(1)
a:remove()
end



-"The wise never quote."
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Dec 2013 11:54 PM
Why? That will just remove it after the first second.
Report Abuse
Laedere is not online. Laedere
Joined: 17 Jun 2013
Total Posts: 23601
22 Dec 2013 11:55 PM
don't use a:Remove()

it just removes the hint on the first loop
Report Abuse
call23re is not online. call23re
Joined: 11 Nov 2010
Total Posts: 9070
22 Dec 2013 11:55 PM
wait I want it to remove when it's over
so where would I put the remove part at?



-"The wise never quote."
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Dec 2013 11:55 PM
After the for loop block
Report Abuse
ColdSmoke is online. ColdSmoke
Joined: 02 Jan 2012
Total Posts: 5784
22 Dec 2013 11:56 PM
lol i feel bad for this guy

you did it really inefficient gaul, it was a nice attempt though. Keep learning and get better at it.
Report Abuse
call23re is not online. call23re
Joined: 11 Nov 2010
Total Posts: 9070
22 Dec 2013 11:59 PM
okay so I took away the remove but it won't countdown, I also want something else to happen after the countdown happens

would I change wait(1) to wait(60)




-"The wise never quote."



Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Dec 2013 11:59 PM
You just put it after the for block.

a = Instance.new("Hint", Workspace)
for i = 60, 1, -1 do
a.Text = i .. " seconds left"
wait(1)
end
a:Destroy()

--your code that will run after the countdown
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