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:
- Create a new baseplate place
- Create a new LocalScript inside
StarterPlayer
>StarterCharacterScripts
- 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)
- 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.
- 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.