local Z={}local y=0 RunService.Stepped:Connect(function(F,g)if y==0 then return end local N=os.clock()local O=1 while O<y do local F=O+1 local g,b=Z[O],Z[F]if not g then break end local U=b-N if U<=0 then if F~=y then Z[O]=Z[y-1]Z[F]=Z[y]Z[y-1]=nil Z[y]=nil y-=2 coroutine.resume(g,N)continue else Z[O]=nil Z[F]=nil y-=2 coroutine.resume(g,N)end end O+=2 end end)
-- Thread/Yield storage
local threads = {}
local n_threads = 0

RunService.Stepped:Connect(function(_, delta_time)
	-- Do not execute if no yields are present
	if n_threads == 0 then
		return
	end

	-- Get the [current_time]
	local current_time = os.clock()

	-- Loop through all the running yields
	local thread_index = 1
	while thread_index < n_threads do
		-- Fetch the [thread] and its [resume_time]
		local resume_time_index = (thread_index + 1)

		local thread, resume_time = threads[thread_index], threads[resume_time_index]

		-- If the current [index] is nil then break out of the loop
		if not thread then
			break
		end

		-- Time elapsed since the current yield was started
		local difference = (resume_time - current_time)

		-- If the yield has been completed
		if difference <= 0 then
			-- Remove it from [threads] table
			if resume_time_index ~= n_threads then
				threads[thread_index] = threads[n_threads - 1]
				threads[resume_time_index] = threads[n_threads]

				threads[n_threads - 1] = nil
				threads[n_threads] = nil

				n_threads -= 2

				-- Resume the [thread] (stop the yield)
				coroutine.resume(thread, current_time)

				continue
			else
				threads[thread_index] = nil
				threads[resume_time_index] = nil

				n_threads -= 2

				-- Resume the [thread] (stop the yield)
				coroutine.resume(thread, current_time)
			end
		end
		thread_index += 2
	end
end)
