Running multiple threads at once

So right now I have a little bit of an issue. I’m trying to run 2 threads at a time, using 2 coroutines, but they never seem to run at the same time, and actually, the second one never seems to run. I’m doing this in a module script, where I’m basically trying to have a script counting down the seconds until a game is finished, while the other is a loop controlling enemy movement. Any ideas? I know using a different script is an option, and that would work, but I’m trying to have only 3 scripts, one of each type, to keep it simple. Here’s what I have right now:

local timer = coroutine.create(function()
		for x = 180, 0, -1 do
			print("Ran")
			local event = ReplicatedStorage:WaitForChild("TimeLeftEvent")
			event:FireAllClients("InGame",x)
			wait(1)
		end
	end)
	
	local cubeMovement = coroutine.create(function()
		local cube = game.Workspace.SewerMap.SpookyCube
		local cubeRay = Ray.new(cube.Position, Vector3.new(100,100,100))
		local characters = {}
		for _, player in pairs(game.Players:GetChildren()) do
			if player:IsA("Player") then
				table.insert(characters,#characters+1, player.Character)
			end
		end
		while wait(1) do
			local hit, position = game.Workspace:FindPartOnRayWithWhitelist(cubeRay,characters)
			if hit then
				print("Player was found")
			end
		end
	end)
	coroutine.resume(timer)
	coroutine.resume(cubeMovement)

I think it’s because you don’t have enough ends or because you’re resuming the coroutine inside of itself.

Try this:

local timer = coroutine.create(function()
		for x = 180, 0, -1 do
			print("Ran")
			local event = ReplicatedStorage:WaitForChild("TimeLeftEvent")
			event:FireAllClients("InGame",x)
			wait(1)
		end
	end)
	
	local cubeMovement = coroutine.create(function()
		local cube = game.Workspace.SewerMap.SpookyCube
		local cubeRay = Ray.new(cube.Position, Vector3.new(100,100,100))
		local characters = {}
		for _, player in pairs(game.Players:GetChildren()) do
			if player:IsA("Player") then
				table.insert(characters,#characters+1, player.Character)
			end
		end
		while wait(1) do
			local hit, position = game.Workspace:FindPartOnRayWithWhitelist(cubeRay,characters)
			if hit then
				print("Player was found")
			end
		end
	end)
	coroutine.resume(timer)
end)
coroutine.resume(cubeMovement)