I can't get my timer to work. Help needed

Hey guys, so am currently trying to make a timer but unfortunately its not working. No errors in the console either :anger:
Here’s the client sided script (in workspace):

local Countdown = game.ReplicatedStorage:WaitForChild("Time")
local TextLabel = game.StarterGui.Timer.Timer

Countdown.Changed:Connect(function()
	TextLabel.Text = Countdown.Value
end)

Server sided script (ServerScriptService):

local Countdown = game.ReplicatedStorage:WaitForChild("Countdown")

while Countdown.Value > 0 do
	Countdown.Value = Countdown.Value - 1
	wait(1)
end

In the TextLabel there is no time and its just written label (tested many times):


Thanks!

1 Like

2 Things:

You’re using StarterGui instead of the PlayerGui of a player, StarterGui handles the replication of Guis

Localscripts do not work in workspace, they must be parented to something that belongs to a client

Put the localscript in the textlabel you want to display yhe Countdown and change it to this

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Countdown = ReplicatedStorage:WaitForChild("Time")
local TextLabel = script.Parent

TextLabel.Text = Countdown.Value
Countdown.Changed:Connect(function()
	TextLabel.Text = Countdown.Value
end)
3 Likes

thanks, ill try it when i get time, m out somewhere rn, will do it when i come back home!

1 Like