How do I detect when the player active the shift lock?

Hi there! I am making a local script and I would like it do something when the player active shift lock but I don’t find any tutorials on internet. Shiftlock activation must be send an event to my script. Can you help me please?


Use this API with left shift

1 Like

You tried seraching in api?
There is all about roblox scripting

UserInputService has a lot of nifty functions and properties, one in specific is called the MouseBehavior property

This one checks, well…The current behavior of how the Player’s Mouse runs

There are 3 values it can be set as:

  1. Default (Which it can basically move anywhere within the screen)
  2. LockCenter (Where it LOCKS the Mouse’s Position at the center of the Player’s Screen)
  3. LockCurrentPosition (Where it LOCKS the Mouse’s Position on it’s current position)

What we want is LockCenter, so what we can do is check to see if MouseBehavior would be would to that specific value

Keep in mind that anywhere Player/Client sided must be done from a LocalScript in order to properly work, and there are limited areas to where you can use it on:

local UIS = game:GetService("UserInputService")

    if UIS.MouseBehavior == Enum.MouseBehavior.LockCenter then
        print("Enabled Shift Lock")