so i'm trying to make a text label gui count seconds left in a round in a game, but i dont know how to get it to work.
--I use gameTime as the variable for how much time is left, in this case 30 seconds local gameTime = 30
i don't know if this is even remotely right but i tried doing
local counter = game.StarterGui.top.timeCounter.Text
then referencing it later right after i print this and subtract 1 second each second
print("Game time remaining = "..tostring(gameTime)) gameTime = gameTime - 1 if gameTime - 1 then counter = gameTime.Value
but i have no ideas
Here try this
Make a StringValue in ReplicatedStorage and name it Status
Make a script in ServerScriptService
And make a localscript inside the textlabel of the countdown
Use this code
Script
local gameTime = 30 local status = game:GetService("ReplicatedStorage"):FindFirstChild("Status") for i = gameTime,0,-1 do status.Value = "Game in progress: "..i wait(1) end
LocalScript
local status = game:GetService("ReplicatedStorage"):FindFirstChild("Status") script.Parent.Text = status.Value status:GetPropertyChangedSignal("Value"):Connect(function() script.Parent.Text = status.Value end)