PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

MouseDeltaSensitivity

UserInputService

float

This property determines the sensitivity of the user’s Mouse.

The sensitivity determines the extent to which a movement of the physical mouse translates to a movement of the mouse in-game. This can be used to adjusted how sensitive events tracking mouse movement, like UserInputService/GetMouseDelta|GetMouseDelta, are to mouse movement.

This property does not affect the movement of the mouse icon. Nor does it affect the Camera Sensitivity setting found in the Settings tab of the client’s Settings menu, which also adjusts the sensitivity of events tracking mouse movement.

This property has a maximum value of 10 and a minimum value of 0. A lower value corresponds to lower sensitivity, and a higher value to higher sensitivity.

When sensitivity is 0, events that track the mouse’s movement will still fire but all parameters and properties indicating the change in mouse position will return DataType/Vector2|Vector2.new(), or DataType/Vector3|Vector3.new() in the case of InputObject/Delta|InputObject.Delta. For example, UserInputService/GetMouseDelta|GetMouseDelta will always return (0, 0).


Code Samples


Create a Binoculars Script

This example creates a binoculars script that decreases the player’s Camera/FieldOfView|FieldOfView and UserInputService/MouseDeltaSensitivity|MouseDeltaSensitivity when a player with a UserInputService/MouseEnabled|MouseEnabled left mouse clicks. The script also points the player’s Camera towards the DataType/Vector3|Vector3 world position of the mouse click determined by the Mouse|Mouse’s Mouse/Hit|Mouse.Hit.p property.

When the player left mouse clicks again, the player’s camera reverts back to the a custom Enum/CameraType|CameraType with the same field of view and Camera/CFrame|CFrame as before the player zoomed in with the script.

While the player uses the binoculars, the script locks the player’s mouse to the center of the screen by setting the player’s UserInputType/MouseBehavior|MouseBehavior to LockCenter. The player’s camera moves when the player moves their mouse according to the InputObject/Delta|InputObject.Delta property passed by UserInputService/InputChanged|InputChanged indicating the mouse’s DataType/Vector2|Vector2 change in screen position.

In order for this example to work as expected, it should be placed in a LocalScript.