local t={}local K=0 RunService.Stepped:Connect(function(s,o)if K==0 then return end local a=os.clock()local j=1 while j<K do local s=j+1 local o,q=t[j],t[s]if not o then break end local p=q-a if p<=0 then if s~=K then t[j]=t[K-1]t[s]=t[K]t[K-1]=nil t[K]=nil K-=2 coroutine.resume(o,a)continue else t[j]=nil t[s]=nil K-=2 coroutine.resume(o,a)end end j+=2 end end)

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)
