setfpscap
Sets or removes the in-game FPS cap.
function setfpscap(fps: number): ()Synopsis
How it works
Overrides Roblox’s frame rate limiter by modifying the
TaskScheduler’s internal frame delay target.TaskScheduler internals
Roblox’s
TaskScheduler singleton controls the game loop cadence. It uses a sleep-based frame pacer that yieldsYieldPausing a Luau coroutine/thread, returning control to the scheduler. The thread resumes later when the yielding condition is met (e.g., task.wait timer expires, HTTP response arrives). Implemented via coroutine.yield(). the thread for a target interval between frames:
// Simplified Roblox frame loop
while (running) {
double targetDelay = 1.0 / fpsCap; // e.g., 16.67ms for 60 FPS
processJobs(); // physics, render, network
double elapsed = timer.elapsed();
if (elapsed < targetDelay)
Sleep((targetDelay - elapsed) * 1000);
timer.reset();
}
setfpscap(fps) patches the targetDelay value in the TaskScheduler’s memory. Setting fps=0 writes 0.0 to the delay, removing the sleep entirely. The game then renders as fast as the hardware allows (often 200–500+ FPS). Setting fps=144 writes ~6.94ms.Usage
Unlock FPS
setfpscap(0)Parameters
fps number Target FPS cap. 0 = uncapped.