rsa-os / Roblox-Scheduler

A really simple scheduler.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Roblox-Scheduler

A really simple scheduler.

Installation

For use in a rojo-like setup:

git clone https://github.com/rsa-os/Roblox-Scheduler
mv Roblox-Scheduler/Scheduler dir-you-want-to-copy-it-to
rm -rf Roblox-Scheduler

For use in a Roblox Studio setup:

Download the latest release from releases and drag/drop into an opened place in Roblox Studio

Usage

Setting up

local Scheduler = require(game.ReplicatedStorage.Scheduler).Scheduler
Scheduler:Init()

Fast scheduling

local deltaTime = Scheduler:FastSchedule(1)
print(deltaTime)

Manual scheduling

local scheduledObject = Scheduler:Schedule(1, coroutine.create(function(deltaTime)
  print(deltaTime)
end)
-- can cancel it if you feel like it
scheduledObject:Cancel()

Timed scheduling

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

Seperated scheduler

local Scheduler = require(game.ReplicatedStorage.Scheduler).Scheduler.newScheduler('name_here')
-- use the scheduler

This will use the given name for profiling in the microprofiler

About

A really simple scheduler.

License:MIT License


Languages

Language:Lua 100.0%