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

How would I make a server timer that starts when the game is made?

Asked by 5 years ago

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.

2 answers

Log in to vote
1
Answered by 5 years ago

Hi guywithapoo,

I would simply put a server script in 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:

local startingTime = 30 -- 30 seconds timer
local increment = 0.05 -- Will change time by 0.05 seconds

local function runTimer()
    surfaceGuiText.Text = startingTime - increment;
end

while startingTime > 0 do -- While loop that keeps running until the timer runs out.
    wait()
    runTimer() -- Runs the function as soon as the script runs.
end

Hopefully, I was of help. Have a nice day/night.

Thanks,

Best regards,

IdealistDeveloper

0
Thank you for the help! guywithapoo 81 — 5y
Ad
Log in to vote
0
Answered by
EDLLT 146
5 years ago
Edited 5 years ago

You could also do this and is more efficient

textlabel=game.Workspace.Part.SurfaceGui.TextLabel -- PATH TO TEXT LABEL HERE
textlabel.Text=tostring(math.floor(game.Workspace.DistributedGameTime))
0
I appreciate the help! guywithapoo 81 — 5y

Answer this question