Run it
Copy the script and paste it into your executor.
local VirtualInputManager = game:GetService("VirtualInputManager")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
-- 【常量预存】
local MOUSE_BUTTON_2 = 1
local isHolding =
()
UserInputService.KeyboardEnabled UserInputService.MouseEnabled
cx, cy = ,
()
size = .CurrentCamera.ViewportSize
cx, cy = size.X / , size.Y /
()
.CurrentCamera:():(updateCache)
()
isHolding
VirtualInputManager:(cx, cy, MOUSE_BUTTON_2, , , )
VirtualInputManager:(cx, cy, MOUSE_BUTTON_2, , , )
isHolding =
UserInputService.MouseBehavior = .MouseBehavior.LockCenter
()
isHolding
UserInputService.MouseBehavior = .MouseBehavior.Default
VirtualInputManager:(cx, cy, MOUSE_BUTTON_2, , , )
isHolding =
RunService:(, .RenderPriority.Camera.Value + , ()
()
isHolding ()
isLocked = (UserInputService.MouseBehavior == .MouseBehavior.LockCenter)
isFirstPerson = (.CurrentCamera.Focus.Position - .CurrentCamera.CFrame.Position).Magnitude <
isLocked isFirstPerson
()
()
)
UserInputService:():(()
()
current = UserInputService.MouseBehavior
current == .MouseBehavior.LockCenter isHolding
()
)
()
Fix MouseLock for Delta UI bug. I hope it is you want.

Universal