Is it possible to cap FPS?

I have a game where having a higher than 60 FPS gives you an unfair advantage where they move quicker in the environment (I don’t know why, it just is how it is).

To stop this I have a script that doesn’t let them do anything until they cap their framerate; turn off their FPS unlocker.

Is there anyway to just cap their frame rate using a script instead?
I saw in Super Nostalgia Zone they somehow cap frame rate at 30.


But they don’t?

Are you sure trying to patch the >60 FPS advantage is absolutely not possible? I feel like that’d be a better solution than trying to use use an FPS cap as a bandaid.

They do.

Interesting; didn’t notice that was a thing. Curious as to how the man does it now.

Maybe you could try writing some kind of function that waits enough time for FPS to be <= 30 using RunService.RenderStepped?

Although I still would rather look into why the >60 FPS advantage can’t be fixed.

1 Like

The advantage is the speed you can ascend in terrain water.

Probably has something to do with RenderStepped, really hoping roblox can change the water terrain swimming mechanics in the future though.

Couldn’t figure out a good solution so instead moved to tackling the FPS as a short-term solution.

Yes it is possible to do FPS capping, using tick() and RenderStepped. I made a 60FPS cap script, but keep in mind scripts like these can cause unnecessary lag. I personally use fps unlockers, so I just changed all my RenderStepped functions to be independent of frame rate by using DeltaTime so that I wouldnt need the FPS script anymore

Try this:

local fps = 30
local clock = tick()

while true do
    while clock + 1/fps > tick() do end
    clock = tick()

Credit to @1waffle1 for the script.


where did the “fps” come from?

Is this from a renderstepped script or something

Just declare fps in the beginning of the script.
Edit: I have modified the script.

Aight I understand, cool

30 charrr

I made a script, copy pasted your script, and placed it in ServerScriptStorage.

Hey, just tested it out. It works for me in Studio but not in game, I’m still clueless why.

ServerStorage is for storing items not needed to be replicated to clients

1 Like

In a studio test the client and server ends are running on the same machine (yours). In an online game that script would only be slowing down the server. It needs to slow down the client. So @OptimisticSide’s code should be put in a local script in StarterPlayerScripts.

1 Like

Did as you said and I tested it out.

The script lowered the FPS count but did not really cap it to the number listed.

Ex. I set the fps variable to 10, when I went into my place with my FPS unlocker my FPS was still around 130 FPS
When I had the variable set to 60 I was around 180 FPS
When I had the script disabled I was around 270 FPS

You aren’t supposed to cap the FPS if it gives you an advantage. You’re supposed to write code that works with all framerates.

local RunService = game:GetService("RunService")

    -- multiply the movement amount by deltaTime.

You most likely forgot to multiply the movement by deltaTime before you applied it on the player. Delta time is basically the time it took to render the last frame, and it’s useful in creating smooth animations on any framerate, and making sure things tied to renderstep happen at the same speed on all clients, no matter what their framerate is.

In the unlikely even that it’s in a roblox script, you can just clone the roblox scripts while you’re testing and then paste it into studio when you’re done testing. Then, find the code that relates to swimming and make sure they are multiplying the movement by deltaTime. If they aren’t, you can edit the script to fix it, and then file a bug report.

Capping FPS is going to make a lot of players confused/annoyed, and they’re probably going to leave the game because of it. Instead of finding a hacky solution like capping FPS, you should just fix the actual issue.

There’s a helpful devforum article on it here:


I know this conversation happened a few months ago, but I was trying to do the same thing and the script didn’t work. It capped fps, but not at the specified number. I don’t know why this is. Ex: Specified number: 10 Fps: 22

This is a better script:

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

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:


Thanks for the help. I just tested it and it capped at exactly 30.