#Is it necessary to disconnect events from a player when leaving?

1 messages · Page 1 of 1 (latest)

lunar needle
#

Example code:

local Players = game:GetService("Players")

local Connections = {}

Players.PlayerAdded:Connect(function(Player)
    Connections[Player] = Player.CharacterAdded:Connect(function(Character)
        print("Character added")
    end)
end)

Players.PlayerRemoving:Connect(function(Player)
    Connections[Player]:Disconnect()
    Connections = nil
end)
north ocean
#

i dont think you have to do it manually

lunar needle
#

Ok thanks