Is it possible to cap FPS?

This is a better script:

local RunService = game:GetService("RunService")
local MaxFPS = 30
while true do
    local t0 = tick()
    RunService.Heartbeat:Wait()
    repeat until (t0 + 1/MaxFPS) < tick()
end

Note this won’t be exact (normally within 5 fps, lower fps values will be closer to the desired FPS) but is closer than what was posted. Also, unless this is for an effect (like Super Nostalgia Zone’s 30 fps cap to emulate old roblox), code should be designed to work on any framerate, so just keep that in mind :slightly_smiling_face:

23 Likes