Will this disconnection script work?

local Connections = {}
local Players = game.Players

Players.PlayerAdded:Connect(function(Player)

Connections[Player.Name] = Player.CharacterAdded:Connect(function(Character)

end)

end)

Players.PlayerRemoving:Connect(function(Player)

Connections[Player.Name]:Disconnect()

end)

1 Like

When the player leaves, it is Destroyed, which means all existing connections will be free for garbage collection (deletion). In other words, you don’t need to manually disconnect these connections.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.