RBXConnectionManager – Simplify Event Handling!
GitHub Repository: RBXConnectionManager
Wally Package: jarnster/rbxconnectionmanager
Why Use RBXConnectionManager?
Managing connection events in Roblox can quickly become messy when dealing with multiple RBXScriptConnection
objects. If you forget to disconnect them, your game can suffer from memory leaks or unexpected behavior.
RBXConnectionManager solves this problem by providing a structured way to handle connections, ensuring they are properly stored, monitored, and cleaned up when no longer needed.
Key Features
Easy Connection Management – Store and access connections by name.
Automatic Cleanup – Player-specific connections are removed when a player leaves (server-side only).
Batch Disconnection – Disconnect all connections or specific groups at once.
Event Monitoring – Track event calls with timestamps for debugging.
Self-Destruction – Completely clean up the manager when needed.
Installation
Manual: Download
RBXConnectionManager.lua
from GitHub and add it to your Roblox project.
or using Wally: Add to wally.toml:
[dependencies]
rbxconnectionmanager = "jarnster/rbxconnectionmanager@0.1.3"
Require the module where needed:
local RBXConnectionManager = require(path.to.rbxconnectionmanager)
How to Use RBXConnectionManager
Basic Example (Server-side Car Show Handler)
This script demonstrates how to manage event connections in a structured way:
Example: a game with car shows, every player has it’s own car booth and you want to connect an event when you recieve OnCarShowClicked for a specific player (in this case, when the player leaves, you don’t want to listen anymore to the player’s car booth).
local Players = game:GetService("Players")
local RBXConnectionManager = require(game.ServerScriptService.rbxconnectionmanager)
-- Create a new connection manager
local connectionManager = RBXConnectionManager.new()
-- Example RemoteEvent
local remoteEvent = game.ReplicatedStorage.SomeRemoteEvent
-- Connect an event with automatic tracking
Players.PlayerAdded:Connect(function(playerObj)
local userid = playerObj.UserId
connectionManager:Connect("OnCarShowClicked_" .. tostring(userid), remoteEvent.OnServerEvent, function(triggeringPlayer, data)
print(triggeringPlayer.Name .. " triggered the event with data:", data)
warn("Send " .. triggeringPlayer.Name .. " congratulations about " .. triggeringPlayer.Name .. " clicking on his car show")
end, true) -- Enable monitoring
end)
In this example, the connection will be automatically destroyed when the player leaves, so the amount of active connections doesn’t keep accumulating and improves performance in situations where you need a lot of script connections.
Why This is Better Than Manually Managing Connections
Prevents Memory Leaks – Ensures all connections are properly disconnected.
Reduces Repetitive Code – No need to manually store and clean up event listeners.
Improves Debugging – Track which events are firing and when.
Open Source & Contributions
RBXConnectionManager is open-source and completely free to use in any Roblox project. Contributions and improvements are welcome!
This is our first open-source release. Please add a on GitHub and
on the DevForum if you like the idea of this project or if you like to use it.
Consider joining our community aswell! Discord - Group Chat That’s All Fun & Games to see progress on our very advanced projects and enjoy early-access benefits while you still can!
Make your connection event handling easier, cleaner, and more efficient with RBXConnectionManager!