Quick tip: changing the shift lock key binding, icon, and offset without forking

Want to rebind the shift lock key binding to another set of key, change the cursor icon while shift lock is enabled, or change the shift lock offset? Instead of forking PlayerModule, which will prevent future updates to it being delivered, you can directly alter the responsible value objects from a LocalScript:

local Players = game:GetService("Players")

-- Name(s) of Enum.KeyCode items separated by commas
local KEYS = "LeftControl,RightControl"
local ICON = "rbxassetid://123456789"
local OFFSET = Vector3.new(1, 0, 0) -- The default is (1.75, 0, 0).

local mouseLockController = Players.LocalPlayer
	.PlayerScripts
	:WaitForChild("PlayerModule")
	:WaitForChild("CameraModule")
	:WaitForChild("MouseLockController")

local function changeSetting(objName, objClass, objValue)
	local obj = mouseLockController:FindFirstChild(objName)
	if obj then
		obj.Value = objValue
	else
		obj = Instance.new(objClass)
		obj.Name = objName
		obj.Value = objValue
		obj.Parent = mouseLockController
	end
end

changeSetting("CursorImage", "StringValue", ICON)
changeSetting("CameraOffset", "Vector3Value", OFFSET)
changeSetting("BoundKeys", "StringValue", KEYS)
5 Likes