Have you ever played the game PSYCHOCATS in roblox? I somewhat noticed that the I and O keys weren't working and the K and L keys replaced it. Does anyone else know how to change the zoom in/zoom out keys? Part of the script:
--Define UserInputService local uis = game:GetService('UserInputService')
--Define UserInputService local uis = game:GetService('UserInputService') --InputBegan uis.InputBegan:connect(function(input,process) --Make sure it's not a game process if not process then --Check key 'E' if input.KeyCode == Enum.KeyCode.I and Player.CameraMaxZoomDistance = 400 Player.CameraMaxZoomDistance = 0.5 then local CameraSetting local Player = game.Players.LocalPlayer Player.CameraMaxZoomDistance = 15 Player.CameraMinZoomDistance = 5 end end end)
There are a few methods you could use:
if input.KeyCode == Enum.KeyCode.I then
), or alternatively change the keys or behaviour involved (ex you could make it zoom faster/slower or use different keys to zoom).Notably, #1 does not stop you from scrolling in/out with the mouse wheel - it only prevents 'i' and 'o' from zooming in/out.
Looking at your script and assuming it's #2 that you're after, you don't need to listen to InputBegan, you just need to assign the properties to the camera. If you put the CameraMinZoomDistance to the same value as the CameraMaxZoomDistance, 'i' and 'o' won't do anything (and nor will scrolling in/out). The script as you currently have it sets the ZoomDistance only after you press 'i', and doesn't fully disable zooming in/out (though it restricts it a lot). Further, the if statement ensures that the code to set up the camera only runs once. Better would be to disconnect the event (though in this case, you don't need the event in the first place)
@MessorAdmin --Define UserInputService local uis = game:GetService('UserInputService')
--InputBegan uis.InputBegan:connect(function(input,process) --Make sure it's not a game process if not process then --Check key 'E' if input.KeyCode == Enum.KeyCode.I and Player.CameraMaxZoomDistance = 400 Player.CameraMaxZoomDistance = 0.5 then local CameraSetting local Player = game.Players.LocalPlayer Player.CameraMaxZoomDistance = 15 Player.CameraMinZoomDistance = 5 end end end)
This is the script I mean't to say.