Skip to content
TheChatArchiveThe Chat Archive
Geminigemini-2.5-flash-preview-04-17· GoogleHugging Face LMArena Human Preference 140K

Could you make it so the script doesn't mess with the players sensitivity? as that is a…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Kimikimi-k2-0711-preview’s answer.
  1. User

    Could you make it so the script doesn't mess with the players sensitivity? as that is a MAJOR no-no in making Roblox games

  2. Gemini Assistant

    You are absolutely right! Apologies, using a fixed sensitivity value in a custom camera script is indeed bad practice as it overrides the player's personal preference set in the Roblox settings menu.

    The fix is simple: instead of using a hardcoded SENSITIVITY constant in the script, we need to read and use the player's actual MouseSensitivity property. This property automatically reflects the value the player sets in the Roblox escape menu.

    Here's the updated script that respects the player's sensitivity setting:

    📜 Updated LocalScript: OverTheShoulderCamera.lua

    Place this in StarterPlayer > StarterPlayerScripts as a LocalScript.

    local Players = game:GetService("Players")
    local RunService = game:GetService("RunService")
    local UserInputService = game:GetService("UserInputService")
    
    local player = Players.LocalPlayer
    local camera = workspace.CurrentCamera
    local character = player.Character or player.CharacterAdded:Wait()
    local humanoid = character:WaitForChild("Humanoid")
    local rootPart = character:WaitForChild("HumanoidRootPart")
    
    -- Settings
    local CAMERA_OFFSET = Vector3.new(2, 1.5, 6) -- Right, Up, Back (slightly to the right of the player)
    local MAX_Y_ANGLE = math.rad(80)
    local MIN_Y_ANGLE = math.rad(-80)
    
    -- Internal
    local cameraAngleX = 0
    local cameraAngleY = 0
    local isRightMouseDown = false
    
    -- Disable default camera and controls
    camera.CameraType = Enum.CameraType.Scriptable
    UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
    
    -- Lock mouse on input (Optional: If you want the mouse always locked, remove this)
    UserInputService.InputBegan:Connect(function(input, gameProcessed)
    	if input.UserInputType == Enum.UserInputType.MouseButton2 then
    		isRightMouseDown = true
    		UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
    	end
    end)
    
    UserInputService.InputEnded:Connect(function(input)
    	if input.UserInputType == Enum.UserInputType.MouseButton2 then
    		isRightMouseDown = false
    	end
    end)
    
    -- Mouse movement
    UserInputService.InputChanged:Connect(function(input)
    	if input.UserInputType == Enum.UserInputType.MouseMovement then
    		local delta = input.Delta
    		-- *** MODIFIED HERE: Use player.MouseSensitivity instead of a fixed value ***
    		cameraAngleX -= delta.X * player.MouseSensitivity
    		cameraAngleY = math.clamp(cameraAngleY - delta.Y * player.MouseSensitivity, MIN_Y_ANGLE, MAX_Y_ANGLE)
    	end
    end)
    
    -- Update camera and character rotation
    RunService.RenderStepped:Connect(function()
    	if not character or not rootPart then return end
    
    	-- Calculate camera CFrame
    	local startCFrame = CFrame.new(rootPart.Position) * CFrame.Angles(0, cameraAngleX, 0) * CFrame.Angles(cameraAngleY, 0, 0)
    	local cameraCFrame = startCFrame:ToWorldSpace(CFrame.new(CAMERA_OFFSET))
    	local cameraFocus = startCFrame:ToWorldSpace(CFrame.new(CAMERA_OFFSET.X, CAMERA_OFFSET.Y, -10000))
    
    	camera.CFrame = CFrame.new(cameraCFrame.Position, cameraFocus.Position)
    
    	-- Force character to face the OPPOSITE of the camera direction (inverted look vector)
    	local lookVector = Vector3.new(math.sin(cameraAngleX), 0, math.cos(cameraAngleX)).Unit  -- Original look vector
    	local invertedLookVector = -lookVector  -- Invert it to face "behind"
    	rootPart.CFrame = CFrame.new(rootPart.Position, rootPart.Position + invertedLookVector)  -- Character faces the inverted direction
    end)
    

    ✅ Key Changes

    • Removed SENSITIVITY constant: The line local SENSITIVITY = 0.002 is gone.
    • Using player.MouseSensitivity: In the InputChanged function, where the camera angles are updated based on mouse delta, * SENSITIVITY has been replaced with * player.MouseSensitivity.

    Now, the speed at which the camera rotates in response to mouse movement will scale correctly with whatever sensitivity the player has set in their game settings. This provides a much better user experience.

    Thanks for catching that!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.