Plugin gui not working

So, I’ve been wanting to learn on how to create a plugin because I’ve been working on one currently. I used a couple of YouTube tutorials but I didn’t get the expected results. I also didn’t get any errors. Here’s my code:

local ChangeHistoryService = game:GetService("ChangeHistoryService")
local tb = plugin:CreateToolbar("Custom Building Parts")
local newbutton = tb:CreateButton("Custom Building Part Options", "Custom Building Parts", "rbxassetid://7017384160")
local opened = false

local NW = plugin:CreateDockWidgetPluginGui(
	"Custom Building Part Options",
	DockWidgetPluginGuiInfo.new(
		Enum.InitialDockState.Float,
		true,
		true,
		200,
		44,
		200,
		44
	)
)



script:WaitForChild("PluginGui"):Clone().Parent = NW

Adding on, here’s my problematic results in words:

In words it basically shows up a gui but it’s blank.

I feel like the problem is because I’ve missed something in this script.

1 Like

You might want to set that to true. Trial and error is very good!

Does the exact same thing and yes, I agree trial and error is very good and an efficient way of learning scripting.

You could have also made a typo in:

Make sure that is correct.

The spelling is correct but that’s not my problem (although it isn’t actually loading the icon). The problem is that it basically shows up a gui but it’s blank.

Well your going to need a ScreenGUI in the code. And make sure the properties are set right, in the ScreenGUI
Example:
examplePlugin
It doesn’t always have to be in Workspace, too. Also, triple check the code. I am not good at plugin type coding, but I think this might be the problem.

My gui wasn’t actually enabled but I keep getting this error:

Meaning:
Infinite yield possible on is a warning in Roblox Studio that means there is a possibility that your script could be stuck on that line waiting forever if object it is waiting on doesn’t exist and is never created.

So there may be something there putting it into a forever loop!

It says PluginGui is not a valid member of the script even though it is? I’ve checked if I had any typos and I didn’t.

That depends on code in the Gui. Try and look at the code there. If there is none, then you might need it for it to have a “link” as I call it. It may still reference it, but what is in the code there?

Your plugin is working correctly, however you haven’t added any GUI elements to change the appearance of it. Please at least try to make a GUI for the plugin before asking questions like this.

(i clearly didn’t read the script correctly)

What do you mean by a gui element, I have a gui.

I didn’t realise, is the PluginGui a Frame?

No it’s a screen gui by the way.

First of all, change it to a Frame, a ScreenGui doesn’t work.

Nope that still didn’t work. I still get the problematic results.

That’s expected since you need to replace the WaitForChild with something like this

NW.Title = "plugin name here"

NW.Name = "plugin name here"

local MaxSize = 12
local MinSize = 6
local ThicknessSize = 0
local IsBorder = false
local AutoAdjustZIndex = true
local GlobalZindex = true
newbutton.Click:Connect(function()
NW.Enabled = not NW.Enabled

end)

local BaseGui = script.Parent.PluginGui
BaseGui.Parent = NW

I’m on my phone so I can’t guarantee that this’ll work however I’m looking through one of my plugins source code and this should work :grin:


Make sure the PluginGui is a Frame and it won’t work unless you move it up into YourPluginsFolder.PluginGui and not YourPluginsFolder.Script.PluginGui

Also to solve this, I had a similar issue a while ago and someone suggested this

This unfortunately did not also work.

I updated it with some advice, also it would help showing the output