I’m making a gui which you can use the mouse wheel to scroll between elements. Ialso want to account for touch pad scrolls, and the code I wrote for it does detect mouse pad scrolls, but they go in the wrong direction. Since the mouse wheel and touch pad share the same UserInputType enum, I haven’t found a way to distinguish between the two.
You could check for TouchStarted before the scrolling to determine that it’s not a mouse wheel scroll.
TouchStarted is for touch screens, unfortunately.
Oh I see, yea I should have known lol.
Have you tried printing the UserInputType when an Input Begins to see if there is a difference? If not then I am not sure how to solve this issue.
Actually what if you can detect if a mouse is enabled, since if for say a laptop does not have an actual mouse connected it might return false, but im not sure, it might just return true for the touchpad as well. Worth a try.
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
mouse.WheelForward:Connect(function()
print("Mouse scrolled forwards/upwards!")
end)
mouse.WheelBackward:Connect(function()
print("Mouse scrolled backwards/downwards!")
end)
Relatively simple to achieve this, neither of these events will fire if the touchpad/trackpad is used.