I have a GUI with a button when an object is selected I what one of two things to happen. Insert the object into a list or in the object is already in the list then to be able to edit it.
I could just swap out buttons but I thought I could use the same button. Just change text and events. I have yet to create the edit function but I have the insert function working but I kept getting multiple inserts so I added a debounce but still had the same problem.
So the problem is that although I use disconnect to turn the event off when I turn it back on it just creates a new instance that runs in parallel. I tried to destroy, remove and nil the variable for the connection but I get errors or the same problem.
So is swapping out the buttons my only solution or am I missing something?

2 comments
check if the button's text is the one you want
@Leamir How will that help with removing the event and not creating multiple instances that run at the same time?