Script timeout: exhausted allowed execution time error. And coroutine problems

I have two issues with my game. My second script which is supposed to wait the given value time except it isn’t doing that, instead it gives me this error: Script timeout: exhausted allowed execution time. Secondly I don’t know how to make a coroutine run. Here are my two scripts that work together.
Round system in ServerScriptService:

local Players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local gv = RS.Values.gv
local DiedValue = RS.Values.DV
local wave = RS.Values.Wave
local ZombiesRemaining = RS.Values.ZombiesRemaning
local TimeToWait = RS.Values.TimeToWait.Value
local IGT = RS.Values.InGameTime
local Restart = true

local playersInRound = {}
local playersDisconnected = {}
local playerDies = {}
local lobbyTime = 20
local isOverrided = false
local inRound = false

Players.PlayerRemoving:Connect(function(Player)
	table.insert(playersDisconnected, Player)
	if table.find(playersInRound, Player) then
		table.remove(playersInRound, table.find(playersInRound, Player))
		if #playersInRound == 0 then
			print("Everyone has died!")
			inRound = false
		end
	end
end)

local function doRound()
	inRound = true
	playersInRound = {}
	playersDisconnected = {}
	
	for _, Player in ipairs(Players:GetPlayers()) do
		local Character = Player.Character
		local Humanoid = Character:WaitForChild("Humanoid")
		local HRP = Character:WaitForChild("HumanoidRootPart")
		HRP.CFrame = CFrame.new(0, 0, 0) --good spawn location
		table.insert(playersInRound, Player)
		Humanoid.Died:Connect(function()
			table.insert(playersDisconnected, Player.Name)
			table.remove(playersInRound, table.find(playersInRound, Player))
			if #playersInRound == 0 then
				print("Everyone has died!")
				inRound = false
				task.wait(3)
			end
		end)
	end
end

wave.Value = 1

function Loop()
	while true do
		Restart = false
		for i = lobbyTime, 0, -1 do
			gv.Value = i
			wait(1)
		end
		
		local value = RS.Values.MainGame
		
		coroutine.wrap(function()
			while true do
				task.wait(1)
				value.Value -= 1
				IGT.Value = value.Value
				print("Timer:", value.Value)
			end
		end) 
	
		if ZombiesRemaining.Value <= 0 then
			wave.Value = wave.Value + 1
			value.Value = 120
			ZombiesRemaining.Value = 10 + wave.Value
			if TimeToWait ~= 0.5 then -- If it hasn't reached 0.5 yet
				TimeToWait = TimeToWait - 0.1 -- Decrease the current TimeToWait by 0.1
			else
				TimeToWait = 0.5
			end

			if IGT == 0 then
				Restart = true
				break
			end
		end
	end
end

if Restart == true then
	Loop()
end

task.spawn(function()
	while task.wait() do
		if not inRound then
			doRound()
		end
	end
end)

ZombieSpawner in ServerScriptService

local RS = game:GetService("ReplicatedStorage")
local wave = RS:WaitForChild("Values"):WaitForChild("Wave")
local waveminus = 0.1

while true do
	if RS.Values.gameInProgress1.Value == true then
		local SpawnPoints = workspace.SpawnPoints:GetChildren()
		local NumberOfSpawnPoints = #SpawnPoints
		local RSP = math.random(1, NumberOfSpawnPoints)
		local ChosenSpawnPoint = SpawnPoints[RSP]

		local Zombies = RS:WaitForChild("Mobs"):GetChildren()
		local NumberOfZombies = #Zombies
		local RZ = math.random(1, NumberOfZombies)
		local ChosenZombie = Zombies[RZ]

		local ClonedZombie = ChosenZombie:Clone()
		local FS = ClonedZombie:WaitForChild("Enemy"):WaitForChild("FollowScript")

		ClonedZombie.Parent = ChosenSpawnPoint
		ClonedZombie:PivotTo(ChosenSpawnPoint.CFrame)
		
		local TimeToWait = RS.Values.TimeToWait
			wait(TimeToWait.Value)
		end
	end

The Error isnt related to a coroutine, it more so means that you are running something that the Server cannot keep up with, or something that crashes the game.

And I recommend putting a task.wait within the loop instead of just using an if statement because if that condition is false, it will ignore it, and not yield.

The error is occurring on the second script I think it has something to do with the value its waiting for.

local TimeToWait = RS.Values.TimeToWait
			wait(TimeToWait.Value)
		end
	end

This Value is set to 10 and after each wave the first script takes away 0.1 from the 10. The question I’m asking for the first script is how do you run a coroutine?

You don’t need a corountine, but for future reference its coroutine.create.
Then you use corountine.resume(starts it).

Please refer to the documentation provided.