Is it possible to detect Mouse wheel click?

Hello. I’m making my plugin. But I have small problem - Left Mouse Button and Right Mouse Button aren’t enough! I need use Mouse Wheel for click, to drag entire Node editor workspace. Does someone know, how I can use Mouse wheel in roblox, bc I can’t find ANYTHING about it, unless scrolling.

You can look into UserInputService for this.

Here’s an example code, taking it straight from the documentation.

-- We must get the UserInputService before we can use it
local UserInputService = game:GetService("UserInputService")

-- A sample function providing one usage of InputBegan
local function onInputBegan(input, _gameProcessed)
	if input.UserInputType == Enum.UserInputType.MouseButton3 then -- Getting MouseButton3 is the Middle Mouse Button.
		print("The left mouse button has been pressed!")
	end
end

UserInputService.InputBegan:Connect(onInputBegan)
1 Like

Sadly, UserInputService can work normally only when in Viewport, but not in PluginWidgets.

Yes it is possible.

You can use MouseWheelForward and MouseWheelBackward in Guis (Yes on the ScreenGuis.).

1 Like

But I need CLICK of mouse wheel, not scrolling only.

I think you cannot do it, it is probably very hard, but I’m gonna do it, don’t worry.

I mean yeah you can.