Is there any loop that runs at a consistent 60 times per second?

Hello!

I recently ran into the issue of fps unlockers and runservice.renderstepped but I can’t wrap my head around how delta time works. So I am wondering if there is any loop that runs at a consistent 60 times per second.

Edit: I’ve been trying for about an hour or 2 trying to get deltatime to work looking at guides but I can’t seem to implement it into my fps system so I’m looking for an alternative.

You could use RunService.Hearbeat.
The Heartbeat event fires every frame, after the physics simulation has completed

https://developer.roblox.com/en-us/api-reference/event/RunService/Heartbeat

Also this may be useful to you

As Heartbeat fires every frame, it runs on a variable frequency . This means the rate will vary depending on the performance of the machine. If the game is running at 40 FPS, then Heartbeat will fire 40 times per second and the step argument will be roughly 1/40th of a second.

1 Like
local Steps = 0
local Time = os.clock()
repeat
	local Clock = os.clock()
	repeat
		os.clock()
	until os.clock() - Clock > 1 / 60
	Steps += 1
until Steps == 60
print(Steps, os.clock() - Time) --60 1.000010600022506
1 Like

Can you post the code you’re trying to get to work? I can try to help and explain how it works