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…

1 Like
local UserInputService = game:GetService("UserInputService")

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

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