I am making a round based sword fighting game, and I am making a timer script with a GUI. My script located in the Workspace simply decrements a variable every second, and sets it to the text of a GUI label. It goes through the loop once, and stops, leaving me with just 29.
Here is the script:
local intermissionTime = 30 -- in secs
local roundTime = 180 -- roundtime in secs
local timerMode = 1 -- 1 means intermission, 2 means round mode
local timerGui = game.StarterGui.timerGUI
while wait(1) do
-- set timeLabel text to whatever the time left is
if timerMode == 1 then
roundTime = 180 -- set roundTime back to 180 since we're
-- in intermission right now
intermissionTime = intermissionTime - 1
timerGui.Frame.timeLabel.Text = (tostring(intermissionTime))
if intermissionTime < 1 then
timerMode = 2
end
elseif timerMode == 2 then
intermissionTime = 30 -- set intermissionTime back to 30
roundTime = roundTime - 1
timerGui.Frame.timeLabel.Text = tostring(roundTime)
if roundTime < 1 then
timerMode = 1
end
end
end
Thanks in advance!

4 comments
The issue seems to be that you're using StarterGui instead of the client's PlayerGui. You would need to update the text in each player's UI rather than just StarterGui. I recommend storing some IntValues somewhere and updating the time remaining on each client based on these IntValues, using a localscript.
is this a local or server script?
this is a server script
also, lolzmac, your method did not work, i tired using a localscript and the playergui and it didnt wokr