LockCenter and LockCurrentPosition are Broken

Issue Type: Other
Impact: High
Frequency: Constantly
Date First Experienced: 2020-03-25 00:03:00 (+00:00)
Date Last Experienced: 2021-02-17 00:02:00 (+00:00)

Reproduction Steps:

  • Create LocalScript in PlayerStarterScripts

  • Insert the following lines of code

    local UserInputService = game:GetService("UserInputService")
    UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter

  • Hit Play

Expected Behavior:
When mouse behaviour is locked, the mouse is meant to be locked either to the center of the screen or its last position.

Actual Behavior:
The mouse is free to move around the screen.

This is a fixed player module rbxm.
Apparently lines 1129 through to 1134 in the BaseCamera module set MouseBehavior to default every frame.

PlayerModule-Fixed.rbxm (110.0 KB)

Duplicate of old bug from March last year:


Correction this works when binding it to RenderStep and a priority higher than the Camera priority. But I don’t believe this behaviour is documented anywhere.

local UserInputService = game:GetService("UserInputService")

game:GetService("RunService"):BindToRenderStep("MouseLock", Enum.RenderPriority.Camera.Value + 1, function()
	UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter

Thanks for the report! We’ve filed a ticket to our internal database and we’ll follow up when we have an update for you.


Thanks for the follow-up on this Opplo.
I manged to get around this by modifying something in one of the local player scripts. I can’t remember what exactly I changed but it solved the problem for me. I just had to make sure that the fixed duplicate was in the starter player folder.


I can confirm this is still happening as of May 2021.

There is a workaround, but it’s still an undesired bug as I wasn’t sure if it was my code or another problem with Roblox.

The culprit is line 1384 in the camera script PlayerModule.CameraModule.BaseCamera as shown below. By commenting it out, I no longer have the issue. It does appear for me like it’s reverting it every frame which would render UserInputService.MouseBehavior useless unless if you use a RunService loop as pointed out by @opplo.


Bug is still alive and kicking.

I tried to override the PlayerModule code to see if it would stop resetting the MouseBehavior to default, but the issue still persists. May this be something internal?


Can confirm that this bug has been unresolved to this day - developers still have to resort to using workarounds that don’t always work right out of the box:

In the first clip, rotation was successful using UserInputService:GetMouseDelta() and having the MouseBehavior changed to Enum.MouseBehavior.LockCurrentPosition (Also tested LockCenter with the same results). Note that the line of code used to change the behavior property was within a RenderStepped loop.

In the second clip below , the code used was the exact same - only the line of code changing MouseBehavior was one line before the RenderStepped loop was created. (Therefore being set only once. To provide context: The RenderStepped loop ends when the user stops holding their Left Mouse button. Setting the Mouse behavior only happens once in my moudule script with no other code that could ever possibly conflict with it.) As you can see, the property is never actually set or is instantly overridden by an internal script or the Roblox engine.


Bump. Still seems unresolved.

Making do with hacky workarounds but it’d be nice to have this fixed.

1 Like