Changing Shift lock keybind

Trying to look inside StarterPlayer.StarterPlayerScripts for BoundKeys doesn’t work as the object is created at runtime inside Players.LocalPlayer.PlayerScripts. You also don’t need to fork PlayerModule and opt out of future updates.

The best approach is to change the bound keys at runtime from your own LocalScript:

local Players = game:GetService("Players")

-- Name(s) of Enum.KeyCode items separated by commas
local KEYS = "LeftControl,RightControl"

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

local obj = mouseLockController:FindFirstChild("BoundKeys")
if obj then
	obj.Value = KEYS
else
	obj = Instance.new("StringValue")
	obj.Name = "BoundKeys"
	obj.Value = KEYS
	obj.Parent = mouseLockController
end
62 Likes