I created a plugin that is meant to sync scripts to the filesystem, and vice versa. This plugin exists as a single button that you can find in the “Plugins” tab. I never use
Plugin:Activate. The idea is that the plugin always runs regardless of what other tools you’re using.
When I save it as a local plugin, studio refreshes all plugins, but it still seems like my old plugin is still running in the background –
particularly the threads spawned with . I want to kill these threads when my plugin refreshes.
Does anyone know how to detect when plugins are refreshed? Or another good way to solve this particular problem?
For those interested in reproing...
Create a script in workspace with the following source, then just right click twice on it, selecting “Save as Local Plugin”. Overwrite the plugin when you save it the second time.
local ID = game:GetService("HttpService"):GenerateGUID(false):sub(10, 13); print("plugin " .. ID .. " starting"); spawn(function() while true do print("plugin " .. ID .. " running") wait(5) end end)
Things I've tried...
- plugin.Changed event
- Button.Changed event
- plugin.Deactivation event
- polling plugin properties, like RobloxLocked (always false, even after unloading) or Parent (always nil).
Edit: this applies to threads spawned with spawn, and all individual scripts’ threads.