Plugin MouseButton1Click Event is not firing, just why?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a plugin that allows me to import mesh into RobloxStudio

  2. What is the issue? Include screenshots / videos if possible!
    The problem is that when I press my button it does not work.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I looked up my other plugin and it doesn’t look any different than my current plugin, so I don’t understand anything. I have googled this thing, but I did not find anything.

So, please, just why? I have been programming on Roblox for years now (2 years, not that long, but still, I know the simplest things) and I have never seen anything like it. Recently I started programming plugins, and now I’m stuck here. I already have practically everything I need, and the only thing that blocks me is this little thing. I find it embarrassing and really annoying, if someone finds out why/where this problem happens, it would be really helpful. And no, this is not the first time I work with GUIs. I have created over hundreds of GUIs in total, so why?

Here you can find the MainScript source code:

local ButtonManager = require(script.MainBackground.Scripts.ButtonManager)
local toolbar:PluginToolbar
local toolbarCombiner = game:GetService("CoreGui"):FindFirstChild("FrostDracony's Suite")
local Enabled:boolean = false

if toolbarCombiner then
	toolbar = toolbarCombiner.Value
	if toolbar == nil then
		toolbar = plugin:CreateToolbar("FrostDracony's Suite")
		toolbarCombiner.Value = toolbar
	end
else
	toolbar = plugin:CreateToolbar("FrostDracony's Suite")
	toolbarCombiner = Instance.new("ObjectValue")
	toolbarCombiner.Value = toolbar
	toolbarCombiner.Name = "FrostDracony's Suite"
	toolbarCombiner.Parent = game:GetService("CoreGui")
end

local Button = toolbar:CreateButton("FrostDracony's MeshEditor",
	"Powerfull Tools for working with Meshs", 
	"rbxassetid://1507949215")

--Just, just dont see above. This is used for saving the toolbar accross different plugins
--Basic Plugin, i dont need to explain it at all
local widgetInfo = DockWidgetPluginGuiInfo.new(
	Enum.InitialDockState.Right,
	false,
	true,
	700,
	300,
	300,
	150
)

local PluginWidget = plugin:CreateDockWidgetPluginGui("MeshEditor", widgetInfo)
PluginWidget.Name = "FrostDracony's MeshEditor"
PluginWidget.Title = "MeshEditor"
PluginWidget.Enabled = false

local Background:Frame = script.MainBackground

ButtonManager:Init()

local function OnButtonClicked()
	Enabled = not Enabled
	PluginWidget.Enabled = Enabled
	Button:SetActive(Enabled)
	
	if Enabled then
		Background:Clone().Parent = PluginWidget
	else
		PluginWidget.MainBackground:Destroy()
	end
	
end

Button.Click:Connect(OnButtonClicked)

And here is the ButtonManagerScript source-code:

local module = {}

local StudioService = game:GetService("StudioService")
local OBJLoader = require(script.Parent.OBJ_Loader.OBJLoader)
local AddButton = script.Parent.Parent.OtherBackground.AddButton

function module:Init()
	print("INIT")
	AddButton.MouseButton1Click:Connect(function()
		print("CLICK")
		local File:File|nil = StudioService:PromptImportFiles({"obj"})
		if File then
			OBJLoader.loadOBJ(File)
		else
			warn("FrostDracony's MeshEditor: File importing was cancelled, retry.")
		end
	end)
end

return module

That’s all I show. I think this is all I could do. If someone found out the problem, this would be really helpful. Thanks for reading:

~~Eterna

Oh sorry, i forgot to add a picture of my main problem. Without this you can’t understand whats the problem. Here is a picture to

and

The picture to understand the whole problem:

Nvm, forgot this. I was checking at the false location (i was checking at the PluginDebugService Button, not at the PluginGuiService Button). I will mark this as solved.

I believe it could be because you’re trying to call the MouseButton1Click:Connect() function from within your module:Init() function. Try taking the MouseButton1Click function outside of it, and let me know if it works.

1 Like

Nono, i solved this. I am using the PluginDebugger and PluginWidgets, and i was only getting the false button (its like you are getting the button of the StarterGui instead of the PlayerGui, same problem). But thanks for trying!

1 Like

Ahh okay, good to know all’s good! Have a good week.

1 Like