How to enable camera lock via Script

Hey, I want to enable shift lock in my game with a hot key, but I don’t know how to enable and disable shift lock. I used to do it once but I can’t find the code anymore. I’m not looking for a custom shift lock module script, I just need the one line code to change the player’s camera type. Thanks!

2 Likes

If I understand correctly you want to rebind shift lock. To do this you can follow these steps:

  1. Press play in Roblox Studio.
  2. Locate the player module in starterplayerscripts and copy it. starter player > starter player scripts > player module
  3. Stop the Roblox Studio game
  4. paste the script back to where it was. starter player > starter player scripts
  5. press the arrow next to player module and find the script named “MouseLockController.” Open it and go to line 46. You can then change the binds to the keys of your choice

If you followed these steps it should rebind correctly. I apologize if this isn’t what you intended.

Is there another way? I remember when I made it it only needed one line of code and can be accessed from any local script. It had something to do with the player’s camera and also enum something.

game:GetService("UserInoutService").MouseBehavior = Enum.MouseBehavior.LockCenter

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