DevEnableMouseLock doesn't work

If you try to run the suggested code from this wiki page it errors telling you that you don’t have access to that property

https://developer.roblox.com/en-us/api-reference/property/Player/DevEnableMouseLock

image

3 Likes

I assume something is wrong with the script on the dev forum because it says

This can be set server-side during run-time by using a Script . It can not be set client-side.

and later it shows a client sided script, so that does not make much sense

o̶b̶s̶:̶ ̶i̶ ̶h̶a̶v̶e̶ ̶t̶r̶i̶e̶d̶ ̶t̶h̶i̶s̶ ̶a̶ ̶f̶e̶w̶ ̶m̶i̶n̶u̶t̶e̶s̶ ̶b̶e̶f̶o̶r̶e̶ ̶y̶o̶u̶ ̶a̶s̶k̶e̶d̶ ̶t̶h̶i̶s̶ ̶q̶u̶e̶s̶t̶i̶o̶n̶,̶ ̶n̶e̶i̶t̶h̶e̶r̶ ̶s̶e̶r̶v̶e̶r̶ ̶o̶r̶ ̶c̶l̶i̶e̶n̶t̶ ̶s̶i̶d̶e̶d̶ ̶w̶o̶r̶k̶e̶d̶,̶ ̶o̶n̶ ̶c̶l̶i̶e̶n̶t̶ ̶s̶i̶d̶e̶ ̶i̶t̶ ̶j̶u̶s̶t̶ ̶l̶a̶c̶k̶s̶ ̶p̶e̶r̶m̶i̶s̶s̶i̶o̶n̶ ̶a̶n̶d̶ ̶o̶n̶ ̶s̶e̶r̶v̶e̶r̶ ̶s̶i̶d̶e̶,̶ ̶a̶p̶p̶a̶r̶e̶n̶t̶l̶y̶ ̶n̶o̶t̶h̶i̶n̶g̶ ̶h̶a̶p̶p̶e̶n̶s̶.

EDIT: I am sorry, after some more testing , i noticed i was trying to a execute a server script with the client, you are going to need to use Remotes for that function (it is server sided really)

1 Like

Checkout this code:

2 Likes

So just to clarify a little bit:

  • Those Dev… properties are generally designed to be used for the initial game settings, including
    whether or not the developer overrides the user’s ability to change the game settings they refer to.
  • Yes, there have been many bugs relating to the Dev… settings, and there is some support for
    changing them mid-game, but that is not what they are really designed for.
  • @Quenty showed how you can disable the MouseLock keys client-side by simply blanking-out
    the list of keys registered for the MouseLock toggle feature.
  • So if you are actually just attempting to at times temporarily disable toggling MouseLock during
    gameplay, look to Quenty’s code.
    Gotchas:
  • Mind entry/exit of menus so they can be navigated properly and MouseLock can be restored.
  • An edge case exists for devices with both touch & KB: There is no initial MouseLockController,
    so you will have to instantiate your own on each spawn!

Why is this server sided?

Shiftlock seems like such a common use case in many games. Why isn’t this easier to do in a LocalScript?