Plugin Unloading event is not working

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

When the following script is saved as Save As Local Plugin and the plugin is updated,
“Unloading Plugin…” is never printed.

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 it’s a problem with the studio or my code.
Could you save the script as a plugin and test it?

1 Like