Disable Player Control without Disabling Mobile Buttons

I’m trying to move my character like a vehicle by disabling player controls, and script the movement with humanoid:Move()

But I can’t see to find a way to disable the controls while keeping the mobile buttons (I need their input)

  1. ContextActionService - Doesn’t work for mobile.
  2. PlayerModule - Removes mobile button.
  3. DevTouchMovementMode and DevTouchMovementMode - Removes mobile button
  4. WalkSpeed & JumpPower = 0 - Need this to move the character with script.

(1) would be ideal but it only works for controller and keyboard for some reason.
(2) would be possible if I created my own buttons.
(3) would be possible if I created my own buttons.
(4) is possible with BodyMovers. But then I can just use Seat like a normal vehicle.

Right now (3) seems to be most stable choice since (2) requires a Roblox module that might change in the future. But I’m thinking I could have missed something? Like another API, combining WalkSpeed with Sit, disable HumanaoidStateType or (1) with mobile.

2 Likes

One option is to “disconnect” the Roblox control script from the character, so that it keeps doing all the work it normally does but it never reaches the character.

If you look into the ControlModule, it controls the character through its OnRenderStepped method, which is connected to RenderStepped in ControlModule.new. See lines 106 and 258 of ControlModule.

This gives you two choices:

  1. Overwrite OnRenderStepped with your own, empty function temporarily.
  2. Unbind "ControlScriptRenderstep" from RunService, then rebind it with a function that calls OnRenderStepped with dt when you’re done.

Both of these options should leave everything as if you could control the character, but without it actually doing so. You can even pull from its methods like :GetMoveVector() in order to use the default controls!

If you’re concerned about these scripts being updated and breaking, you can just place a copy of them in StarterPlayerScripts and they won’t be updated. You can then update them manually and screen each update. I doubt you’d run into any issues even if you did let them auto-update.

10 Likes

Wow thank you that worked perfectly!

Here’s the code for those who might be interested

-- Init

local PlayerModule = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"))

local Controls = PlayerModule:GetControls()

local RunService = game:GetService("RunService")

-- Disable Control

RunService:UnbindFromRenderStep("ControlScriptRenderstep")

-- Regain Control

RunService:BindToRenderStep("ControlScriptRenderstep", Enum.RenderPriority.Input.Value, function(dt) Controls:OnRenderStepped(dt) end)

-- Get Control's Direction while disabled

Controls:GetMoveVector()
11 Likes