The buttons should work and do while playtesting the .rblx file, but the buttons do not work in the plugin window. The buttons I am talking about are the buttons that appear upon clicking nil.
Right-click should change the selected directory and Left-click should select the instance.
I tried looking at old posts, but no one, and I MEAN NO ONE has the same issue.
I also tried debugging and the buttons are active and the scripts are Enabled. What’s causing the issue?
local toolbar = plugin:CreateToolbar("Replacer")
local button = toolbar:CreateButton("Replacer", "Use this tool to replace any instance with an instance!", "http://www.roblox.com/asset/?id=14760187383")
-- Create new 'DockWidgetPluginGuiInfo' object
local widgetInfo = DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Float, -- Widget will be initialized in floating panel
true, -- Widget will be initially enabled
false, -- Don't override the previous enabled state
800, -- Default width of the floating window
500, -- Default height of the floating window
350, -- Minimum width of the floating window (optional)
350 -- Minimum height of the floating window (optional)
)
-- Create new widget GUI
local testWidget = plugin:CreateDockWidgetPluginGui("Replacer", widgetInfo)
script.Parent.Parent = testWidget
testWidget.Title = "Replacer"
button.Click:Connect(function()
testWidget.Enabled = true
end)
Sorry to hear that, I actually just found a solution which worked for me.
Instead of putting the script inside the button or a frame It would only work if I attached it to the main script which handles the plugin button creation.
I have no clue why myself, I just know that fixed it. I’ve made plugins in the past and it worked fine and the script could be in the button itself.
Why don’t you just i initiate it from a singular script?
Widget could be running from a different context.
During playtest you actually run 2 instances of plugin: Plugin Context and Client Context.
Simply ensure plugin script has a Plugin RunContext.
local Toolbar = plugin:CreateToolbar("SimpleScripts")
local Main = Toolbar:CreateButton(
"Scripts",
"Scripts Made Easy",
"rbxassetid://95866080"
)
local MainInfo = DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Float,
false, -- Initially enabled
false, -- Overridable by user
400, -- Default width
300, -- Default height
200, -- Min width
150 -- Min height
)
local MainPluginGui = plugin:CreateDockWidgetPluginGui("SimpleScriptsMainGui", MainInfo)
MainPluginGui.Title = "Simple Scripts"
local MainGui = script:WaitForChild("PluginGui"):Clone()
MainGui.Parent = MainPluginGui
for _, AllSystemModels in ipairs(Systems:GetChildren()) do
for _, AllScripts in ipairs(AllSystemModels:GetChildren()) do
local TemplateClone = Template:Clone()
TemplateClone.Name = AllSystemModels.Name
TemplateClone.Visible = true
TemplateClone.Text = AllScripts.Name
AllScripts:Clone().Parent = TemplateClone
TemplateClone.Parent = MainGui.Frame.Library.ScrollingFrame
TemplateClone.MouseButton1Click:Connect(function()
AddScript(AllScripts, TemplateClone.Name, TemplateClone)
end)
end
end
That isn’t the full script, things will be missing but It should give you an idea.
So essentially the function to check when a button is clicked is in the same script as where you create the plugin button.
I also heard putting it in a module script as a child in the plugin script also works but I haven’t tried that.