I read about the disconnect function, but I still don’t understand when to use it.
For example if I have a function:
local connection
local part = script.Parent
connection = part.Touched:Connect(function(otherPart)
print(otherPart.. " Touched me -_-"
end)
connection:Disconnect()
What should I do if I want to call the function again?
You should only use disconnect if you are no longer going to use the function OR your script would make multiple connections to the same thing, disconnect the other one first!
1 Like
So in my game I have a lot of function check for different button(not the same buttons) clicks, so do I need to disconnect them at any time?
If they all check for different buttons and they are always gonna be used (and you don’t connect them multiple times) then there is no need for :Disconnect()
1 Like
Ok Thx for the quick answer!
char limit
1 Like