I am using FOV to make a Sniper Zoom Effect, and In order to make the sniper actually work properly, I need to make the MouseDeltaSensitivity Lower… How can I make it revert to the original sensitivity the player had set after I stop zooming in?
Example
function: plr zooms in & mouse delta sensitivity = 0.5
after unequipping or pressing right click again, the mouse sensitivity should go back to normal, but how would I know the normal sensitivity or reset it?
You need to use the user input service, here is some example code:
local UserInputService = game:GetService("UserInputService")
local origSens
function Aim(toAim)
if toAim then
origSens = UserInputService.MouseDeltaSensitivity
UserInputService.MouseDeltaSensitivity = origSens / newFOV -- divide the origSens by whatever your new camera FOV is
else
UserInputService.MouseDeltaSensitivity = origSens
end
end
Edit: Also, unless you have messed with the MouseDeltaSensitivity prior to this, default sensitivity is always 1 (MouseDeltaSens is not the same as camera sens)