How can I lock the mouse cursor to the middle of the screen?

The control scripts are setting MouseBehavior back, so to stop that you will need to set it every frame.

local RunService = game:GetService"RunService"
local UserInputService = game:GetService"UserInputService"
RunService:BindToRenderStep("MouseLock",Enum.RenderPriority.Last.Value+1,function()
    UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
end)
55 Likes