local I=game:GetService("\082\117\110\083\101\114\118\105\099\101")local b={}local V={}local p=nil local function h()if#V==0 then p=p and p:Disconnect()end for I,b in next,V do if os.clock()-b[2]>=b[1]then local p=b[3]table.remove(V,I)p()break end end end function b.AddTask(i,b,t)if p==nil then p=I.Stepped:Connect(h)end b=b or 0 t=t or function()print("\069\109\112\116\121 \067\097\108\108\098\097\099\107 \070\117\110\099\116\105\111\110")end local Z=#V V[Z+1]={b;os.clock();t}end return b
--|| Services ||--
local RunService = game:GetService("RunService")

local TaskScheduler = {}
local Cache = {}
local SteppedConnection = nil

local function OnStepped()
	if #Cache == 0 then
		SteppedConnection = SteppedConnection and SteppedConnection:Disconnect()
	end

	for Index, Queue in next, Cache do
		if os.clock() - Queue[2] >= Queue[1] then
			local Callback = Queue[3]
			table.remove(Cache, Index)
			Callback()
			break
		end
	end
end

function TaskScheduler:AddTask(Duration, Callback)
	if SteppedConnection == nil then
		SteppedConnection = RunService.Stepped:Connect(OnStepped)
	end

	Duration = Duration or 0
	Callback = Callback or function()
		print("Empty Callback Function")
	end

	--| Sort
	local CacheSize = #Cache
	Cache[CacheSize + 1] = { Duration, os.clock(), Callback }
end

return TaskScheduler
