Coroutine not working correctly! (SOLVED)

Hello!
Back at it again.
I accidentally changed something from a coroutine and now it’s broken.
It handles a board that has parts that flash every second when something is on
Example: ReactorActive true = Reactor Online flashing every 1 second
I don’t know how to fix it so now I am here.

Script
module.Board = coroutine.create(function()
	while true do
		for i,v in pairs(workspace.F2.ControlRoom.ReactorBoard:GetChildren()) do
			if module[v.Name] then
				if module[v.Name] == true then
					v.Material = Enum.Material.Neon
				end
			end
		end
		task.wait(1)
		for i,v in pairs(workspace.F2.ControlRoom.ReactorBoard:GetChildren()) do
			if module[v.Name] then
				v.Material = Enum.Material.SmoothPlastic
			end
		end
		task.wait(1)
	end
end)

What does the output say? It appears the code you provided is fine.

Absolutely nothing. What it does is at first not flicker at all then it starts flickering very fast.

Did you start the coroutine with corotuine.resume?

Are you running module.Board multiple times?

Well yes. I wouldn’t be stupid to not resume the coroutine.

No. I just resume it once and that’s all.

Can you try adding a print() before each task.wait()? Also, if possible, can you give a clip of what you see?

Sure! I will do that now. Please wait…

EDIT: aa my OBS is updating it may take longer.

1 Like

Actually I think I fixed this problem. There were 2 coroutine.resume(module.Board)

EDIT: IT WORKS! YAY!

1 Like

2 coroutine.resumes would only be necessary if a coroutine’s function body yields via coroutine.yield.