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!
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;
How Would I arrange the GUI? I tried it but didn't quite work my way. How are you setting up the GUI?