Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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

1 comment

0

Thank you for the help!

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))

1 comment

0

I appreciate the help!

This discussion is preserved as it was. New answers, comments, and votes are closed.