How to detect scrolling of mouse wheel

I’m doing an inventory script roughly speaking. I need some kind of event, which will detect mouse wheel scrolling. It would be desirable that there would be 2 events. Up and down. To do when the scrolled wheel down, things have changed as in Minecraft from left to right, and when the wheel is scrolled up, on the contrary. Searched for the events in UserInputService and couldn’t find it. Help…

2 Likes
local UserInputService = game:GetService("UserInputService")

UserInputService.InputChanged:Connect(function(input, processed)
    if processed or input.UserInputType ~= Enum.UserInputType.MouseWheel then
        return
    end
    
    local up = input.Position.Z == 1
    
    print(if up then "Up!" else "Down!")
end)
5 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.