Why is my timer not working

My goal is to make it so the timer will work like I’m doing it from the server because before it worked from the client.

Client script (the coroutine has an end but I cut it because it’s not important):

Not the whole client script

coroutine.wrap(function()
	
	TimerEvent:FireServer(30)







TimerEvent.OnClientEvent:Connect(function(time_)
	TimeLabel.Text = time_
end)

Server Script:

TimerEvent.OnServerEvent:Connect(function(Player, timer)
	for i = timer, 1, -1 do
		TimerEvent:FireAllClients(i)
		
		task.wait(1)
	end
end)

The timer doesn’t work at all, and there are no errors.

Hi! Please next time send the whole script and try this:

ServerScript

TimerEvent.OnServerEvent:Connect(function(Player, timer)
      repeat
             timer = timer - 1
             TimerEvent:FireAllClients(timer)
             wait(1)
      until timer == 0
end)

client Script:

coroutine.wrap(function()
	TimerEvent:FireServer(30)
end)

TimerEvent.OnClientEvent:Connect(function(time)
	TimeLabel.Text = tostring(time)
end)

didn’t worrk ): charrrrrrrrrrr

coroutine.wrap returns a function, are you running said function coroutine.wrap(function() end)()?

Oh then try this:
Client Script

TimerEvent:FireServer(30)

TimerEvent.OnClientEvent:Connect(function(time)
	TimeLabel.Text = tostring(time)
end)

Thanks for the help I fixed it.

1 Like