How do I detect when the player is shift locking?

I wanna detect when a player is shift locking how would I do that?

1 Like

I am really not totally sure, but I suggest you try this:

local UIS = game:GetService("UserInputService") 
UIS.InputBegan:Connect(function(key) 
if key.UserInputType == Enum.UserInputType.Keyboard then 
if.key.KeyCode == Enum. KeyCode.LeftShift then 
if game.StarterPlayer.EnableMouseLockOption == true then
--Your code here
end
end
end 
end)
1 Like

Indent the code for the person seeing it.


UIS.InputBegan:Connect(function(key)
if key.UserInputType == Enum.UserInputType.Keyboard then
if.key.KeyCode == Enum. KeyCode.LeftShift then

if game.StarterPlayer.EnableMouseLockOption == true then
–Your code here
        end
     end
  end
end)

To indent code, just type 3 quote marks ```, this will make it easier for the person reading to understand the code.

Oh ok thx lol I am not necessarily new to devforum but I don’t usually do this kind of comment so thank you

1 Like

No problem. Just use that so that people can understand the code.

1 Like

That way they can find it easier to read :slight_smile: