Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Mystdar 352 Moderation Voter
10 years ago

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?

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). Perci1 4988 — 10y

2 answers

Log in to vote
1
Answered by 10 years ago

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?

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" adark 5487 — 10y
Ad
Log in to vote
1
Answered by
Filipalla 504 Moderation Voter
8 years ago
Edited 8 years ago
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

Answer this question