What is the :Disconnect() function primarily used for?

You have just answered your own question. That is what it does.

Say for instance you have a part that kills a player. But you only want the part to kill one player. Disconnecting the Touched connection would come in handy:

local connection
connection = script.Parent.Touched:Connect(function(part)
    if part.Parent:FindFirstChild("Humanoid")
        part.Parent.Humanoid.Health = 0
        connection:Disconnect()
    end
end)
62 Likes