ContextActionService not sinking input for MouseWheel

Normally, binding a function with ContextActionService to MouseWheel and returning Enum.ContextActionResult.Sink (or nil which defaults to the same thing) would stop the camera script from picking up the input and performing a camera zoom.
This still works properly in studio. However, in a live game, now the camera will zoom even with the same binding.

This bug happens 100% of the time, I have tested in a new baseplate to isolate the issue. To recreate it, all you need to do is:

  1. Create a new baseplate place
  2. Create a new LocalScript inside StarterPlayer > StarterCharacterScripts
  3. Set the following code to be the script’s content:
local function onMouseWheel(bindingName, inputState, inputObject)
    print("Scrolled! Camera should not zoom.")
    return Enum.ContextActionResult.Sink
end

game:GetService("ContextActionService"):BindAction(
    "TestBinding",
    onMouseWheel,
    false,
    Enum.UserInputType.MouseWheel)
  1. Play solo in studio and try to scroll. Note in the output that your scroll is detected and the input is properly sunk. Your camera does not zoom.
  2. Publish the game to a place and play it in the Roblox player. Press F9 to view the console, try scrolling again (outside the console). Note in the output that your scroll is still detected, but the input is no longer sunk because your camera is actually zooming now.

An uncopylocked place with this script demonstrating it is not working in-game can be found here: ContextActionService Bug - Roblox

Once again, want to emphasize this only happens in-game and not in studio. It also might be related to issues with scrolling over GUIs, like Roblox chat, also zooms your camera and it didn’t use to. They both seem to start happening at the same time.

This issue may extend to other input types, but MouseWheel is the one that affects me and made me notice it.

5 Likes

Were you using a magic mouse 2?

No, I’ve tried a touchpad and a regular mouse on a couple different computers. I came across this bug because players of the game I work on were reporting issues with rotating things, which is done with this binding. I was able to reproduce the issue in a new place and on multiple computers, so I know the issue is not with my hardware or game specifically.

1 Like

This has been happening to my ScrollingFrames when you’re not scrolling over a GuiButton, just like BusyCityGuy says, only in-game. Because my ScrollingFrame is in the center of the screen, eventually it gets to the point where your cursor is stuck in the middle of the screen when scrolling up through an inventory. Having to constantly scroll in and out to move your cursor over what you want to select would be annoying.

I only noticed it about 3 days ago but I was mainly testing in studio before that

Thanks for the report, we’re looking into some potential solutions.

2 Likes

Just noticed today that this issue seems to be fixed finally. Thanks!

1 Like

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