The binding that’s responsible for zooming in/out with the keyboard is “BaseCameraKeyboardZoom”, which you can see in this screenshot:
You can disable it like this:
local ActionS = game:GetService("ContextActionService")
ActionS:UnbindAction("BaseCameraKeyboardZoom")
It won’t work if it runs right away when the player joins, you’ll have to either wait()
a couple of seconds or at other points during the game, e.g. on CharacterAdded or when your own camera script is setting up.
EDIT: Apparently this broke after a while. There’s no longer any default actions bound to BaseCameraKeyboardZoom. Annoyingly the new action is called RbxCameraKeypress and covers both zooming with I and O, as well as panning with Left and Right
You can do this to unbind all 4 keys:
for _ = 1, 2 do
while true do
local info = ActionS:GetBoundActionInfo("RbxCameraKeypress")
if info and info.inputTypes then
ActionS:UnbindAction("RbxCameraKeypress")
break
else
wait()
end
end
end
Trying 2 times works for me in Studio, increase it to a larger number (or even math.huge) if it isn’t enough.
A much better way is this:
local ActionS = game:GetService("ContextActionService")
ActionS:BindActionAtPriority("do nothing", function() return Enum.ContextActionResult.Sink end, false, 3000, Enum.KeyCode.I, Enum.KeyCode.O)
You could also bind any action you actually want to these keys, just make sure you do it at a priority level > default (2000).