I would post this in #bug-reports, but I cant since Im not a regular
It seems that plugin.Unloading fires ONLY when you overwrite the plugin, but not when you close the place in studio.
Simple repro: plugin unloading bug.rbxm (1.1 KB)
Download
Put in ServerScriptService
Save as local plugin
(optional) Click the “Print” button that appeared on the toolbar, just to see that it works
Save the same plugin as a local plugin again
You can see that an “Unloaded” value appeared in ReplicatedFirst
Remove that value
Reopen the place
Now you can see, that the Unloaded value did not get added.
I dont know if Im doing something wrong, or if this is a bug.
Help would be appreciated.
If you have events connected to the descendants of your plugin then they should clean up just fine, but if you have something like RunService.RenderStepped connected, you would need to disconnect that manually
I have selection boxes in workspace. My code is as straightforward as possible. I have them in a table, and the get destroyed in plugin.unloading. This works when i update the plug-in, just not when I close studio. I still believe this is a bug.
Do they have to be in workspace? You can parent them to CoreGui and set Adornee to some part, and those selection boxes will get destroyed on leave automatically