A really simple scheduler.
git clone https://github.com/rsa-os/Roblox-Scheduler
mv Roblox-Scheduler/Scheduler dir-you-want-to-copy-it-to
rm -rf Roblox-Scheduler
Download the latest release from releases and drag/drop into an opened place in Roblox Studio
local Scheduler = require(game.ReplicatedStorage.Scheduler).Scheduler
Scheduler:Init()
local deltaTime = Scheduler:FastSchedule(1)
print(deltaTime)
local scheduledObject = Scheduler:Schedule(1, coroutine.create(function(deltaTime)
print(deltaTime)
end)
-- can cancel it if you feel like it
scheduledObject:Cancel()
local timed = Scheduler:ScheduleEvery(1, function(deltaTime)
print(deltaTime)
end)
-- can also be stopped
timed:Stop()
Both ScheduledObject and TimedObject have a .Destroy alias, so they can be safely used with maids
local Scheduler = require(game.ReplicatedStorage.Scheduler).Scheduler.newScheduler('name_here')
-- use the scheduler
This will use the given name for profiling in the microprofiler