Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Does ClearAllChildren() Disconnect RBXScriptSignals?

Asked by
Minifig77 190
8 years ago

I'm making a GUI that lists all of the items in a table of strings.

Each item in the table is represented by a TextBox with a TextButton inside of it.

Whenever an item's TextButtonis clicked, the item is removed from the list, which is then repopulated. The button's event listener is then disconnected.

Repopulating the list entails destroying all of the TextBoxes with ClearAllChildren(), and then creating the list anew.

ROBLOX Wiki states, > "A connection is automatically disconnected if: ...The object the Event relates to is destroyed with the Destroy method."

It does not, however, mention the ClearAllChildren()method, which could be problematic, considering that the objects that the event listener relates to are destroyed that way.

What I want to know is: Is an RBXScriptSignaldisconnected if its respective object is destroyed by ClearAllChildren()?

0
To clarify, whenever an item is removed from the list, the REST of the TextBoxes are removed using ClearAllChildren(), and I'm concerned that the event listeners connected to the TextButtons inside them won't be disconnected, since Destroy() was not used. Minifig77 190 — 8y

2 answers

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
8 years ago

The ClearAllChildren function uses the deprecated remove function. And, as you may know, the remove function simply sets the parent to nil; it does not disconnect connected events.

0
I didnt even see this before adding my own answer >:L koolkid8099 705 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

The simple answer is no.

Answer this question