What is the purpose of using :Disconnect()
to disconnect something? Is it to clear the memory and prevent memory leaks?
I've personally never used it, how do you use it and what is it for (wiki doesn't explain clearly)?
:Disconnect()
justs disconnects a connection. Here's an example
local connection = part.ClickDetector.MouseClick:Connect(function() print("Clicked!") end wait(5) connection:Disconnect()
What that does is it creates a connection, and when you click the ClickDetector it prints out "Clicked!". After 5 seconds, it won't print "Clicked!" again cause the connection has been disconnected.
If you still don't understand it, feel free to ask!