plugin.Unloading not firing when closing place

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)

  1. Download
  2. Put in ServerScriptService
  3. Save as local plugin
  4. (optional) Click the “Print” button that appeared on the toolbar, just to see that it works
  5. Save the same plugin as a local plugin again
  6. You can see that an “Unloaded” value appeared in ReplicatedFirst
  7. Remove that value
  8. Reopen the place
  9. 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.

2 Likes

Im still having this issue, and it is a huge hinderance because my plugin cant properly clean up after itself. Is there any new information on this?

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

They have to be descendants of workspace in order to render.

Thats not true, I have selection boxes in CoreGui with adornee set to a part and it works just fine

It can be parented anywhere, but has to have the Adornee property set to render

1 Like

Oh… I thought it had to be in workspace because it wouldn’t work in lighting. Ill try core gui.

This works! But I think its because coregui has special behavior. It definatley can not be parented anywhere. Thanks for your help!