How would I make this loop until CT or T is 8?

How would I make this loop every time it ends?

local waittick = 1

local function round()
	local ttiimmee = 120
	while wait(waittick) do
		if ttiimmee > 0 then
			game.Workspace.Time.Value = "Round: "..ttiimmee..""
			print(ttiimmee)
			ttiimmee = ttiimmee - 1
		else
			game.ReplicatedStorage.CT.Value = game.ReplicatedStorage.CT.Value + 1
		end
	end
end

round()
1 Like

Add local loop = false or a repeat until

Did I do something wrong? :pensive:

local warmup = false
local waittick = 0.005
local won = false
local ttiimmee = 120
local oldtime = 120

local function round()
	while wait(waittick) do
		if not won then
		if ttiimmee > 0 then
			game.Workspace.Time.Value = "Round: "..ttiimmee..""
			print(ttiimmee)
			ttiimmee = ttiimmee - 1
		else
			game.ReplicatedStorage.CT.Value = game.ReplicatedStorage.CT.Value + 1
			won = true
			end
		end
	end
end
round()


while wait() do
	if won == true then
	print("you won")
	won = false
	ttiimmee = oldtime
	end
end
1 Like

It should work as how you wanted it to work. try debugging your code

I don’t know. My while wait() do code is broken apparently cause it doesn’t print.

Nevermind I think I know why. There’s two while wait() do’s.

Just making sure this is in a normal script right?

It is indeed a server script. Thanks.

Alright. I’ve found out how to do it. Thanks for the help!

and what was the solution? writing it will help other devs fix their bugs.

I just looped it every time it ends.