UI not going into DockWidgetPluginGui

I want to put a UI into a plugin, but it doesn’t work.

When I save my plugin as a local plugin, it doesn’t have UIs in the plugin.

I have already tried looking it up on the dev hub, but found no helpful topics. I have also tried to make a new frame with Instance.new instead of re parenting a ScreenGui, but it still hasn’t worked.

Heres the code:
local widgetinfo = DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Float,
true,
true,
246,
227
)

local widget = plugin:CreateDockWidgetPluginGui(“UIHelper”, widgetinfo)
local screengui = Instance.new(“ScreenGui”)
screengui.Parent = widget

script.ScreenGui.TextButton.MouseButton1Click:Connect(function()
local selection = game:GetService(“Selection”)
if selection[1] then
for i,v in pairs(selection) do
if v:IsA(“Frame”) or v:IsA(“TextLabel”) or v:IsA(“TextButton”) then
local newframe = Instance.new(“ImageLabel”)
newframe.Position = UDim2.new(v.Position)
newframe.Size = UDim2.new(v.Size)
newframe.ImageColor3 = Color3.new(v.BackgroundColor3)
newframe.AnchorPoint = Vector2.new(v.AnchorPoint)
newframe.Parent = v.Parent
newframe.Image = ‘http://www.roblox.com/asset/?id=5590730321
v:Destroy()
end
end
end
end)

The error is on line 13.

Remove your current Local Plugin file (that ends in .lua). Right click on the plugin script in the explorer and click “Save to File…”. Navigate to “%localappdata%\Roblox\Plugins” in the URI bar, and save it there.

Ok I will try that. Thank you!

It didn’t seem to work. Is there anything wrong with the code?

Not really, from what I can think of, the reason for it not working is because of the fact that when your script is exported as a .lua file, all descendants are lost, resulting in that error which signifies that “ScreenGui” does not exist inside the LocalScript.

I also just tried to publish it as a plugin, but that also had a blank window. So it must be something with the code.