How to use the Mouse delta sensitivity

Hello, soo i am making a gun soo when i aim the mouse sensitivity reduce but i dont know how to use it
the mouse just stop moving

local User = game:GetService("UserInputService")
	if aiming then
		User.MouseDeltaSensitivity = User.MouseDeltaSensitivity / 2
	else
		User.MouseDeltaSensitivity = User.MouseDeltaSensitivity*2
      end
 end)

i dont know if i am using it correctly. pls help

all i need is
how to use it properly

how to reduce the mouse within the player sensitivity like if the player sens is 10 it will reduce by 5 if its 4 then reduce 2 and then return it to normal

You are probably experiencing a looping issue here somewhere in your code. Basically what you are doing is rapidly modifying User.MouseDeltaSensitivity.

You need to track the Original MouseDeltaSensitivity in a variable outside the loop.

local chosenSensitivity = User.MouseDeltaSensitivity

Then in your loop that checks if aiming or not

if aiming then
User.MouseDeltaSensitivity = chosenSensitivity / 2
else
User.MouseDeltaSensitivity = chosenSensitivity * 2
end

Doing this won’t repeatedly change the User.MouseDeltaSensitivity value to 0 or inf

3 Likes

oh wow very cool help thx mate

1 Like

time.DeltaTime * User.MouseDeltaSensitivity * 2