> ## Documentation Index
> Fetch the complete documentation index at: https://docsuncv2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# setfpscap

Sets the game's frame-rate limit.

```luau theme={null}
setfpscap(fps: number): number
```

Most often used to bypass Roblox's built-in fps settings restrictions. Common pattern: drop to `30` on alt accounts or autofarm scripts. Frees CPU and GPU headroom for the active client.

## Parameters

| Parameter | Type     | Description                         |
| --------- | -------- | ----------------------------------- |
| `fps`     | `number` | The new cap, floored to an integer. |

## Returns

`number` - the cap that was active *before* calling `setfpscap()`.

## Aliases

* `setfps`

## Example

In Roblox, wallhops land more reliably at 60 fps.<br />Bind F1 to toggle the cap between 60 and the player's previous setting.

<CodeGroup>
  ```luau Example 1 theme={null}
  <<<<<<< HEAD
  setfpscap(60)
  =======
  -- setfpscap(fps: number): number
  >>>>>>> 50e30f53759b0538759af25c9b271514aa2c9290
  ```

  ```luau Example 2 theme={null}
  local uis = cloneref(game:GetService("UserInputService"))
  local savedCap

  uis.InputBegan:Connect(function(input, gp)
      if gp or input.KeyCode ~= Enum.KeyCode.F1 then return end

      if savedCap then
          setfpscap(savedCap)
          savedCap = nil
      else
          savedCap = setfpscap(60)
      end
  end)
  ```
</CodeGroup>

<Tip>
  Roblox caps actual rendering at \~240 Hz from 2024 onwards.
  Caps above that store and read back fine, but the rendered frame interval won't drop below \~4 ms. [Background here.](https://github.com/bloxstraplabs/bloxstrap/wiki/Why-you-can%27t-%28or-shouldn%27t%29-go-faster-than-240-FPS)
</Tip>
