How do I make a ticks per second system?

How would I make a bindable event run a variable number of times per second so I can write frame rate independent code?
Just want to know if there is any “best” way of doing it compared to using task.wait()

1 Like

i suppose task.wait() is the simplest
if you meant frames you can use runservice

2 Likes

I recommend using
RunService

local te = 0.1

local function tk(dt)
	print(dt)
end

local RS = game:GetService("RunService")
local time = 0
RS.PostSimulation:Connect(function(dt)
	time += dt
	if time >= te then
		tk(time)
		time = 0
	end
end)

1 Like