Closing individual widgets will run functions that are linked to BindToClose, however when they are grouped together and the group is closed none of the widgets run the BindToClose functions.
Here’s a quick plugin script that will create widgets for you to repro this with:
local toolbar = plugin:CreateToolbar("Debug")
local button = toolbar:CreateButton("Button", "Create widget.", "")
local id = 0
button.Click:Connect(function()
local myId = id
local widgetInfo = DockWidgetPluginGuiInfo.new( Enum.InitialDockState.Float, false, false, 50, 50, 50, 50 )
local widget = plugin:CreateDockWidgetPluginGui("Widget"..myId, widgetInfo)
widget.Title = "Widget ".. myId
widget.Enabled = true
widget:BindToClose(function()
warn("Closed widget ".. myId )
end)
id = id + 1
end)
Expected behavior
Closing a group of widgets should run BindToClose for every widget in the group.