Disabling player controls should be less complicated and more unified

As a Roblox developer, it is currently too hard to “truly” turn off all player controls.

The Problem

In order to remove ALL player controls, you must:

  • Call PlayerModule:Disable() - to turn off movement controls
  • Call StarterGuiService:SetCore(“ResetButtonCallback”, false) - to turn off resetting
  • Toggle DevEnableMouseLock - to turn off “Shift Lock Switch”
  • Turn off “AutoRotate” in a player’s humanoid - to turn off spinning if a player were to go in first person (but this may be undesired if you wish to move the player in a cutscene)
  • Depending on the device, unbind (or use booleans) for various ContextActionService actions + listeners

Use Cases

Problem One - Not Knowing the Above

This will sound somewhat sarcastic, but I mean it genuinely. The first problem with disabling player controls is even knowing all of the above options exist and can be utilized.

Problem Two - Knowing the Above, It’s Still Tedious

Even if you know all of the options to turn off player controls, it’s still tedious. You have to tap into 4-5 different areas where player controls exist. This is neither streamlined nor straightforward. New developers must have one heck of a time.

Problem Three - Pcalls and Future-Proofing…

Even if you perform all of these tasks, there is no guarantee they will all succeed. Pcalling and retrying is the solution, but a player may be able to slightly move their character during those failed frame(s).

In addition, all of these workflows are rather scattered. It does not feel future-proof. If Roblox ever changes the default location for these control sources, your approach will be broken.

The Solution

Add a centralized spot for toggling player controls off (perhaps a single property on the Players instance?).

Having granular ways to toggle off player controls is greatly appreciated, but the way to turn OFF everything is incredibly hard to discover + is not user-friendly.

If this issue is addressed, it would improve my development experience because I will be able to more easily turn off player controls and have control over my experience.

43 Likes

:red_circle: I totally agree with this, I am currently using ContextActionService to override the controls. Yet! Mobile players can press their jump button which doesn’t remove at all from the screen and all controls will be gained back. They can just move around in my game lobby after pressing the jump button.

  • As you mentioned, some of the solutions you showed can fail. I have experienced issues with disabling controls via the PlayerModule, the function Disable needs to be called around 2 times because it just doesn’t disable the controls sometimes, same with Enable.

  • SetCore() literally errors if is not loaded yet, making us retry with pcall in a loop until it’s successful.

:green_circle: A property on the player as you mentioned, something like Player.ControlsEnabled would be very useful instead of all those hacky ways to disable them. Is literally a pain to disable controls currently…

12 Likes

I don’t know if this is what you were looking for but after messing around in studio I found that placing a ModuleScript called “PlayerModule” in starter player scripts seems to prevent the controls from working. In studio mobile test mode, the buttons do not pop up on screen.
This disables all player controls, which was what I was looking for since in my game I’m using all custom input and camera scripts.
Screenshot (16)

The only remaining default control behavior seems to be right click lock, which I couldn’t understand why disabling the PlayerModule wouldn’t also disable. I think the camera object in of itself just defaults to right click locking. Setting the camera type property to scriptable still works, even if all the default camera/control/input scripts are removed using the hack above, so it has to be hard coded into the core scripts instead of the playermodule (but setting the other camera types don’t do anything if playermodule is removed), so the right click lock is disabled by setting cam to scriptable

EDIT: character auto loads needs to be off for right click lock to be disabled, for some reason when character spawns, the right click lock enables somehow

For anyone who wants to know, it is much easier to do this now with Character Controllers, because character turning, movement, and jumping are all controlled on the Luau side, with the Reset Character button being the only outlier (although it might still be possible to prevent the character from dying on the Luau side, even if Reset Character is used).