Mouse events do not fire when a mouse is on the plugin widget

I’m trying to make a custom number sequence editor for my particle editor plugin,
The issue is a mouse events don’t fire when a mouse is on the widget.

I have tried activating the plugin, MouseButton events and UserInputService but none of it worked.

Here is the code :

local runService = game:GetService("RunService")
local userInputService = game:GetService("UserInputService")

local toolBar = plugin:CreateToolbar("test")
local newbutton = toolBar:CreateButton("test","test test","http://www.roblox.com/asset/?id=5464564564563")

plugin:Activate(true)
local mouse = plugin:GetMouse()

local widget = plugin:CreateDockWidgetPluginGui("V32OP",DockWidgetPluginGuiInfo.new(
	Enum.InitialDockState.Float,
	false,
	false,
	200,
	300,
	300,
	350
	))

local button = script.Parent.TextButton
button.Parent = widget

userInputService.InputBegan:Connect(function(input)
	
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		
		print("UIS mouse down")
		
	end
	
end)
userInputService.InputEnded:Connect(function(input)
	
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		
		print("UIS mouse up")
		
	end
	
end)

mouse.Button1Down:Connect(function()
	
	print("mouse down")
	
end)
mouse.Button1Up:Connect(function()
	
	print("mouse up")
	
end)


widget.Enabled = true

Here is the video


1 Like

Is there a reason that you’re not using button.MouseButton1Click:Connect(...) here? Do you need all input at all times or just when clicking the button?

Ran into this issue with my plugin Movie Lighting, this is most likely a bug!

1 Like

Oh I’m sorry, i forgot to mention that i had tried it. It only works if user mouse is released on it, but I’m making a graph editor where the keyframe is dragable and i need mouse up input to stop update the key position.

Then use MouseButton1Down instead of MouseButton1Click.

https://developer.roblox.com/en-us/api-reference/event/GuiButton/MouseButton1Down

It fires whenever the mouse button is pushed down (doesn’t need to be a click).

I already used MouseButton1Down to detect when the user start dragging, but the problem is i can’t detect when they stop dragging. MouseButton1up wouldn’t work if their mouse wasn’t on the button.

Connect a MouseButton1Up event inside the MouseButton1Down event.

That’s what i did in the second video, it works but its not what i wanted to achieve.

plus, the event doesn’t fire if the user’s mouse wasn’t released on the button.

Anyway, thanks for the suggestions.

I found that the mouse only works in the scene view. :frowning: I wish roblox would fix this

Maybe it’s a problem with local plugins?

It’s not :sob: