Limiter β Smart FPS & Connection Manager Utility
A simple yet powerful utility to control RunService event frequency and manage connections efficiently.
Overview
Limiter is a lightweight utility module designed to help developers control how frequently code runs on fast frame events (like RunService.Heartbeat) and manage connection lifecycles cleanly.
It allows you to:
- Cap how often your logic executes (e.g., run at 60 FPS instead of 200 FPS).
- Group and easily clear or destroy multiple connections.
- Automatically disconnect after a set duration.
- Keep your performance stable across different FPS environments.
Why Use Limiter?
By default, RunService.Heartbeat or RenderStepped can fire hundreds of times per second on high-FPS clients.
If your game logic doesnβt need to run that frequently, youβre wasting CPU time and creating potential lag.
Limiter solves that by:
- Throttling callback execution to a defined FPS.
- Automatically cleaning up connections in organized groups.
- Giving you full control and structure over connection management.
Usage Example
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Limiter = require(ReplicatedStorage.Limiter)
-- Create a Limiter instance
local limiter = Limiter.new()
-- Example: Limit Heartbeat to 60 FPS for 10 seconds
limiter:limit(
RunService.Heartbeat, -- RunService event to limit
function(deltaTime)
print("Running")
end,
60, -- FPS cap (use Limiter.Presets if preferred)
10, -- Auto-disconnect after 10 seconds (optional)
"testing", -- Group name for easy management (optional)
function()
print("Ended") -- Called when connection is finished (optional)
end
)
-- Clear only the "testing" group
limiter:clear("testing")
-- Clear all groups
limiter:clear()
-- Destroy the Limiter instance completely
limiter:destroy()
Core Functions
| Function | Description |
|---|---|
Limiter.new() |
Creates a new limiter instance. |
limiter:limit(signal, callback, fps, duration?, group?, onEnded?) |
Limits a RunService signal to a custom FPS rate. |
limiter:add(connection, group?) |
Adds a custom connection to be managed by the limiter. |
limiter:clear(group?) |
Clears all or specific group connections. |
limiter:getConnections(group?) |
Returns all connections in a group. |
limiter:destroy() |
Fully destroys the limiter instance and cleans memory. |
Extra Notes
Works with all RunServiceevents:Heartbeat,RenderStepped,Stepped, etc.
Each limiter instance can have multiple groups of connections.
Ideal for AI systems, physics updates, visual effects, and background logic that doesnβt need full FPS precision.
Reduces script clutter by organizing and cleaning up signals easily.
Example Comparison
| FPS | Without Limiter | With Limiter (60 FPS) |
|---|---|---|
| 240 | ~240 executions/sec | 60 executions/sec |
| 120 | ~120 executions/sec | 60 executions/sec |
| 60 | ~60 executions/sec | 60 executions/sec |
Installation
Roblox Creator Store
https://create.roblox.com/store/asset/109967772174196/Limiter
Model Download
Limiter.rbxm (5.2 KB)