Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how can I make a GUI countdown? ( Read desc. to find out what I talking about )

Asked by 7 years ago

Like in Mad Games when a round starting it said "Intermission 30" then 30 seconds later "Teleporting Players" how do I make it countdown and when it reached 0 its make it said "Teleporting Players" can someone make/copy a script and help me out? Like make it countdown to 0 and when it reached 0 then it make the text said "Teleporting Players!"

If you help Thanks! If you closed mine "Wow.... like some or a lot of game have this! How is this not work? It's a script it making the text from the ScreenGUI count down!"

4 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago
for i=30,1,-1 do
wait(1)
gui.Text = "Intermission: "..i
end
gui.Text = "Teleporting players!"

for do loops are similer to while true do loops, but they will only run a stated amount of times although you do not need a wait() in the script becuase it will not break. So it will count down 30 seconds and then say "Teleporting players!" so it is a very easy script to make!

0
Thanks! ZAZC_Noob 7 — 7y
Ad
Log in to vote
1
Answered by 7 years ago

I'm not gonna write the entire script for you, instead, have some wiki articles.

The fundamentals of scripting with GUIs

GUI guide

The wait() function

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

I'm still learning about scripting myself but this seems pretty straight forward if i walk you through it. The basic concept of the Countdown GUI clock is that you are creating a GUI with a preset number, and then if this makes sense, you are creating a script that changes the value of the GUI every second to make it appear like a countdown clock. after that, theres going to be another section/function of the script that basically says if/when the clock reaches zero, execute this action, which in this case is a teleportation function. At least this is how i break this down to look like. Try doing that, it might help a little bit.

Log in to vote
0
Answered by
Master_JJ 229 Moderation Voter
7 years ago

It's very basic actually, I will explain it after.


for i = 30, 1, -1 do gui.Text = "Intermission : " .. tostring(i) end gui.Text = "Teleporting players..."

So first I do a for loop. I put the numbers 30, 1, -1, this will make the variable i equal 30, and count down to 1. The final number is what it will countdown by. When going down you have to use a negative number, because it adds to the first one. Example: 30 + -1 = 29, 29 + -1 = 28, and so on.

The line after the for loop will not run until the foor loop is over, once it counts down to 1, the gui text will switch to "Teleporting players..."

Answer this question