Im interested in putting a server timer in all of my games that will start going up once the game is made. It would be on a SurfaceGui for sure.
Hi guywithapoo,
workspace
that just runs a function to do the count down because it will automatically run once the server starts. So, it would simple be something like this after you have identified the SurfaceGui
text:01 | local startingTime = 30 -- 30 seconds timer |
02 | local increment = 0.05 -- Will change time by 0.05 seconds |
03 |
04 | local function runTimer() |
05 | surfaceGuiText.Text = startingTime - increment; |
06 | end |
07 |
08 | while startingTime > 0 do -- While loop that keeps running until the timer runs out. |
09 | wait() |
10 | runTimer() -- Runs the function as soon as the script runs. |
11 | end |
Hopefully, I was of help. Have a nice day/night.
Thanks,
Best regards,
IdealistDeveloper
You could also do this and is more efficient
1 | textlabel = game.Workspace.Part.SurfaceGui.TextLabel -- PATH TO TEXT LABEL HERE |
2 | textlabel.Text = tostring (math.floor(game.Workspace.DistributedGameTime)) |