Does ResetOnSpawn for ScreenGui Destroy Descendants?

Quick question: is :Destroy() called on all descendants of a ScreenGui when it is reset via the ResetOnSpawn property? I could not find information on this.

I want to make sure all connections bound to UI objects are automatically disconnected, otherwise I would have to manually disconnect all of them upon reset.

I would assume all descendants are being destroyed via :Destroy(), but a clarification with a source would be helpful.

1 Like

It will basically re-render the gui and re-run any scripts inside of the screengui.
I recomment to turn it off and don’t use code inside of screen guis.

1 Like

I understand that, but will connections with TextButton and ImageButton be disconnected when the GUI is re-rendered?

the Destroying event of the screengui is fired when the player respawns which means the screengui was deleted using Instance:Destroy().
The docs of Instance:Destroy() says:

Sets the Instance.Parent property to nil, locks the Instance.Parent property, disconnects all connections, and calls Destroy() on all children.

So to answer on your questions

Yes, :Destroy() is called on the screengui and it’s descendants.

Yes, all events will be disconnected. You will have to connect the events again to the new gui.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.