refactor: move modules to packages (#41)

* refactor: move modules to `packages`

* chore: remove .vscode
This commit is contained in:
richard 2025-01-25 13:12:50 -08:00 • committed by GitHub
parent 89f1dfeaa5
commit 8eddd182d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 152 additions and 174 deletions

View file

@ -0,0 +1,30 @@
local RunService = game:GetService("RunService")
--[=[
Schedules a function to be called at a fixed interval of `seconds`.
@param callback The function to call.
@param seconds The interval in seconds.
@return A function that cancels the interval.
]=]
local function interval(callback: () -> (), seconds: number): () -> ()
if seconds < 0 then
return function() end
end
local clock = 0
local connection = RunService.Heartbeat:Connect(function(delta)
clock += delta
if clock >= seconds then
clock = 0
callback()
end
end)
return function()
connection:Disconnect()
end
end
return interval