Plugin Unloading event is not working

Currently, the Unloading event is not working in my studio.

When the following script is saved using ‘Save As Local Plugin’ and the plugin is updated, ‘Unloading Plugin…’ is never displayed.

local a = if _G.testNum then _G.testNum + 1 else 1
_G.testNum = a

print("plugin Start")

task.spawn(function()
	while wait(1) do
		print(a)
	end
end)

plugin.Unloading:Connect(function()
	print("Unloading plugin...")
end)

image

It’s hard to check if the issue is with the studio or my code.
Could anyone save the script as a plugin and test it?

2 Likes