feat: add state sync

This commit is contained in:
Richard 2024-02-27 22:20:18 -08:00
parent 5fe86ef030
commit 17a8c48e54
9 changed files with 262 additions and 0 deletions

View file

@ -0,0 +1,23 @@
local RunService = game:GetService("RunService")
local function setInterval(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 setInterval