local debounce = true
while debounce == true do
	wait(1)
	game.Workspace.Time.Value = game.Workspace.Time.Value - 1
	if getPlayerNumberInTeam(tostring(game.Teams.Toons.TeamColor)) == 0 then
		debounce = false
		wait()
	elseif game.Workspace.Time.Value == 0 then
		debounce = false
		wait()
	end
	function ot(part)
		local humanoid = part.Parent:FindFirstChild("Humanoid")
		if humanoid ~= nil then
			if game.Players:GetPlayerFromCharacter(humanoid.Parent).TeamColor == BrickColor.new("Really blue") then
				debounce = false
			end
		end
	end
	game.Workspace.Door.Touched:connect(ot)
	wait()
end

Basically, this creates a wait loop until one of three things happens:

  1. Time runs out
  2. Everyone on team "Toons" dies
  3. Someone on the Really blue team touches a certain block

The first two waits to break the loop work fine, but the third way does nothing

function ot(part)
		local humanoid = part.Parent:FindFirstChild("Humanoid")
		if humanoid ~= nil then
			if game.Players:GetPlayerFromCharacter(humanoid.Parent).TeamColor == BrickColor.new("Really blue") then
				debounce = false
			end
		end
	end
	game.Workspace.Door.Touched:connect(ot)
	wait()

Any help?