Plugin UI not showing up

I have been remaking an part counter plugin for fun. And also since this is my first time making an plugin. I’m having problems with making my plugin UI visible when the player has clicked the plugin button. Every time I’ve clicked the plugin this UI pops up.

This is the code for the UI plugin

	Enum.InitialDockState.Float,
	true,
	false,
	200,
	300,
	150,
	150
)

PluginButton.Click:Connect(function()
	local PartInfo = plugin:CreateDockWidgetPluginGui("PartInfo", Info)
	PartFrame.Parent = PartInfo
	PartFrame.Visible = true
end)

This is the UI I want to be shown instead
image

Does anyone mind helping me?

You don’t need to create a new DockWidget every time it opens, just create it once at the start of the script and toggle it by setting Enabled to true or false.

To get the GUI to actually be in the widget, you need to set its Parent to the widget. So you might try

local widget = plugin:CreateDockWidgetPluginGui("PartInfo", DockWidgetPluginGuiInfo.new(
    Enum.InitialDockState.Float, true, false,
    300, 300,
    100, 100
))

local pluginGui = ...:Clone() --should probably be a child of your plugin somehow (make sure you clone, or you'll loose your GUI!!!!)
for _, c in pairs(pluginGui:GetChildren()) do
    c.Parent = widget
end

pluginButton.Click:Connecet(function()
    widget.Enabled = not widget.Enabled
end)