So I want to change the players camera sensitivity in code then I don’t want him to change it to any other value.
I have tried the following I placed the code in local script although it changes the camera sensitivity it changes based on what the player changes it in the settings. So it doesn’t work like I want it to work.
local userInputService = game:GetService("UserInputService")
userInputService.MouseDeltaSensitivity = 0.006
Any ideas on how I can changes the camera sensitivity and keep it there?
-- C = Camera Sensitivity/MouseSensitivity
-- D = MouseDeltaSensitivity
-- formula 0.1 / C = D
-- 0.1 increase to make it the movement speed higher decrease to make it slower
local userInputService = game:GetService("UserInputService")
local UserGameSettings = UserSettings():GetService("UserGameSettings")
local number = 0.1 -- change this number to change speed
local mouseDeltaSensitivity = number / UserGameSettings.MouseSensitivity
userInputService.MouseDeltaSensitivity = mouseDeltaSensitivity
UserGameSettings:GetPropertyChangedSignal("MouseSensitivity"):Connect(function()
mouseDeltaSensitivity = number / UserGameSettings.MouseSensitivity
userInputService.MouseDeltaSensitivity = mouseDeltaSensitivity
end)
Note If the player change his camera sensitivity to 0.001 it goes slower but in my case it is fine since I don’t want player to go faster that the a certain speed