Hello people,
This is my first open source module so if I have done anything wrong don’t be afraid to tell me
Now this is V1 and I will be updating it so any bugs/fixes or even better optimization tips will be really apricated.
Anyways, this module is called BetterConnections
Roblox Model: https://create.roblox.com/store/asset/135494282669414/BetterConnections?viewFromStudio=true&keyword=&searchId=a60f1369-ef56-4ea5-95cd-8fa0537c786d
RBXM File:
BetterConnections.rbxm (5.6 KB)
Here is a example on how to use this module:
Example ServerScript:
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Part = workspace:FindFirstChild("Part")
local Part2 = workspace:FindFirstChild("Part2")
local BetterConnections = require(script:FindFirstChild("BetterConnections"))
local PlayerConnections = {}
local GlobalConnections = BetterConnections.new()
function OnPlayerAdded(player : Player)
PlayerConnections[player] = BetterConnections.new()
if PlayerConnections[player] then
PlayerConnections[player]:Connect("Heartbeat", RunService.Heartbeat, function(DeltaTime)
if Part then
Part.Position += Vector3.new(0, DeltaTime, 0)
end
end)
PlayerConnections[player]:Connect("PostSim", RunService.PostSimulation, function(DeltaTime)
print(DeltaTime)
end)
task.wait(0.2)
PlayerConnections[player]:Disconnect("PostSim")
PlayerConnections[player]:DebrisConnection(3, "Heartbeat2 (this is very original)", RunService.Heartbeat, function(Delta)
print("Heartbeat still here")
end)
PlayerConnections[player]:DisconnectAll()
end
end
function OnPlayerRemoving(player : Player)
if PlayerConnections[player] then
PlayerConnections[player]:Destroy()
end
end
function GlobalConnectionSetup()
GlobalConnections:Connect("KillBrick", Part2.Touched, function(BasePart)
print(BasePart.Name)
end)
end
Players.PlayerAdded:Connect(OnPlayerAdded)
Players.PlayerRemoving:Connect(OnPlayerRemoving)
GlobalConnectionSetup()
(i know the killbrick dosent kill my fault)
IMPORTANT: In the connect function in the module the code paramater is not suppost to be there i forgot to delete it so just leave it nil
anyways lmk if you find anything and feedback like I said is always appreciated thanks for your time.