I want to make a game where you have to race and if you are too slow the ground disappears and you fall into lava. The one thing I'm wondering is how do you make a timer? Like countdown from 60 seconds and make the ground disappear? Also I don't know how to put that on a GUI. I know how GUI's work, I just don't know how to put the timer on it so players can see. Thx!
How Do You Make A Timer?
3 answers
In my opinion, I think you can do it this way as well: (You can modify it, since I haven't known where would want to put the script into)
local ground = game.ServerStorage.Ground
ground:Clone().Parent = game.Workspace
local secs = 60 -- Any number will do as well :)
for i = secs, 0, -1 do
script.Parent.Text = 'Time left: '..i -- The text would be 'Time left: (The countdown)'
wait(1)
if i == 0 then
script.Parent.Text = "Time's up!" -- The text would be "Time's up!" when the countdown reaches 0.
game.Workspace.Ground:Destroy()
end
end
I hope this would work. Leave a comment if you find any problems.
here ya go.
seconds = 10 --number of seconds in the timer --time to wait
for i = 1,seconds do
print(seconds-i)
wait(1)-- waits 1 second
end
you will need a changed event for the gui though. which so long as your script is under the gui then it would be script.Parent;
3 comments
Thx!
wait is about 1 second, not exactly 1. Just note this.
@Axovua does it really matter? It works either way...
How Would I arrange the GUI? I tried it but didn't quite work my way. How are you setting up the GUI?
2 comments
I put the Screen GUI In StarterGUI, then I placed a TextBox Into The Screen GUI. And then put the script into the TextBox.
you do not want to use a textbox, you want to use a frame.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
How would I arrange the GUI?
put the script into the textlabel/textbox of your GUI (btw, i dont know what u mean... srry ): )
Also, u can use a frame. (Insert a ScreenGui into StarterGui (in Explorer) and insert a frame/textlabel or textbox)