I am back with another utility module, ConnectionService!
It’s use is to prevent multiple RunService connections
(Supports Client & Server)
(Avoid using many RunService loops with this module)
If you have a question or any optimization possibilities, let me know!
ConnectionService.lua (1.7 KB)
https://create.roblox.com/store/asset/135631117679083
Documentation:
Functions:
Connect (Loop, Name, Function) [
Creates a new connection with [Name/arg 2] as the index and [Function/arg 3] and adds to the RunService Loop from [Loop/arg 1]
],
Disconnect (Loop, Name) [
Disconnects a connection found in the RunService loop from [Loop/arg 1] with the name [Name/arg 2]
],
Create (Loop) [
Creates a new RunService Loop from [Loop/arg 1]
],
Destroy (Loop) [
Destroys an active RunService Loop from [Loop/arg 1]
]
–
Examples:
local ConnectionService = require(game.ReplicatedStorage.ConnectionService)
ConnectionService.Create("Heartbeat")
ConnectionService.Connect("Heartbeat", "Aitha", function(dt)
warn(dt, "dt")
end)
ConnectionService.Connect("Heartbeat", "Fren", function()
warn(tick(), "tick")
end)
task.wait(2)
ConnectionService.Disconnect("Heartbeat", "Fren")
Enjoy everyone! take care. (Updates will be made soon!)
If you have any useful utilities for me to make in mind, reply with the idea






