Changing Shift lock keybind

Hello, I was wondering if there is a way to change the shift lock keybind to something like alt or control. The reason is because I have a shift to run script that might mess it up if they are both on the same key. Any solution will be appreciated!

15 Likes
local Key = "E"
game.StarterPlayer.StarterPlayerScripts.PlayerModule.CameraModule.MouseLockController.BoundKeys.Value = Key

Line 51
StarterPlayer.StarterPlayerScripts.PlayerModule.CameraModule.MouseLockController
https://i.gyazo.com/a39b72890a1fd7c80e956c2ba1c25d8e.png

https://i.gyazo.com/5f3feed4ac4d6834e5f25aadf33e5531.png

44 Likes

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
45 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.