I was wondering if a connection to a part would stay in memory and not get automatically disconnected regardless if the part destroyed if another part instance is created inside of the connection.
Instances when destroyed get their connections automatically disconnected, however those created in the connection won’t have their connections disconnected until they too are destroyed or disconnected manually.
Memory Leaks happens with some reasons such as:
1- Many connections that arent being disconnected.
2- So many scripts and parts.
3- Global functions, variables.
4- Many threads being created (Coroutines, spawn, delay)
But yes the connections are disconnected once a part is destroyed.
(Other way of disconnecting is making a variable have a nil value and then setting it to the connection, later on doing variable:Disconnect())
So many scripts and parts - this statement is very vague and having a lot of parts and scripts itself will not cause a memory leak.
Global functions and variables - have nothing to do with memory leaks
Many threads being created - have nothing to do with memory leaks.
Memory leaks are only caused by not destroying parts created in scripts when no longer needed, never disconnecting events on instances not destroyed or not removing references to instances in the workspace contained in a table.