[Easy Tutorial] How to have shift lock enabled without the option to change it in settings (Player Module)

For those of you that want to use the in built Shift-Lock but dont want players to be able to switch it off, this is how.

Step One:

In the Explorer, in StarterPlayer Properties, set EnableMouseLockOption to false.
image
This disables the player from being able to toggle it.

Step Two:

Play test the game. In the Explorer under Players. Open your player. In PlayerScripts, copy the PlayerModule.

Step Three:

Stop the play test. Paste the PlayerModule into StarterPlayerScripts.

Step Four:

Open CameraModule under PlayerModule
image

Step Five:

Press Ctrl + F. This will open up a search bar.

Paste this into the search bar: self.activeMouseLockController = MouseLockController.new()

It will bring you to this:

Step Six:

Paste these lines in so that it looks like the image below it:

self.activeMouseLockController:EnableMouseLock(true)
self:OnMouseLockToggled()

Step Seven:

Test it out. If you open settings it should say set by developer. However if you press shift or if you changed the key, you can still shift lock.

8 Likes