Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there a way to detect the mouse scrolling up or down?

Is there a way to check the middle mouse button scrolling up or down I know you can use mouse button 1 for left and mouse button 2 for right but mouse button 3 in code does not work, is there another way?

1 comment

2

Please do your research before coming here, this took me two minutes to find on the Roblox wiki. http://wiki.roblox.com/index.php?title=Mouse  It  will be under Events (obviously).

2 answers

✓ Accepted answer

Yes, in Mouse, there are two events that will help you, WheelBackward and WheelForward.

However, you could also use the new UserInputService's methods like InputBegan. From there, you could check if UserInputType is UserInputType.MouseWheel. I suggest the former method, but who knows how long until Mouse is depreciated in favor of mobile-friendly input?

1 comment

0

UserInputService (the latter) is actually easier to use once you get the hang of it. Also, the word you're looking for is "deprecated"

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

mouse.WheelForward:connect(function(plr)
	print("Wheel Forward")
end)

Edit: I did not see this post was old

This discussion is preserved as it was. New answers, comments, and votes are closed.