Disable player module controls without removing the mobile gui

Doing a custom movement module that uses humanoid:Move(), so I needed to disable controls.

Using something along the lines like this:

local core_controls = require(playerscripts:WaitForChild("PlayerModule")):GetControls()
core_controls:Disable()

This is fine for PC, but doesn’t work for mobile as the GUI disappears.
How do I disable movement controls WITHOUT hiding the GUI?

(I can do something hacky and fork the player module but is there a better way?)

Hey, so I’m assuming you mean the mobile movement GUI? (The thumbstick + jump button)

I tried this myself and as far as I’m concerned the GUI is not removed but just made invisible, so you’d just have to make it visible again, hope this helps.

(Do note; I am not 100% sure it is only made invisible as the emulator isn’t always on point, and even if you made it visible you’d still have to script the thumbstick movement yourself)

2 Likes

It is invisible, but internally the control module just has a straight-up debounce which prevents it from working at all anyway.

1 Like

I made this hacky solution by accessing the DynamicThumbstick module:

local touchgui = playergui:WaitForChild("TouchGui")
local touchframe = touchgui:WaitForChild("TouchControlFrame")

local dynamicthumbstick = require(core_player:WaitForChild("ControlModule"):WaitForChild("DynamicThumbstick"))

local thumbstick = dynamicthumbstick.new()
thumbstick:Enable(true, touchframe)
	
uis.TouchMoved:Connect(function()
	local move_direction = -thumbstick.moveVector
	if move_direction.X > 0 then
		movement_module.RightUp()
		movement_module.LeftDown(move_direction.X)
	elseif move_direction.X < 0 then
		movement_module.LeftUp()
		movement_module.RightDown(move_direction.X)
	else
		movement_module.LeftUp()
		movement_module.RightUp()
	end
	if move_direction.Z > 0 then
		movement_module.BackwardUp()
		movement_module.ForwardDown(move_direction.Z)
	elseif move_direction.Z < 0 then
		movement_module.ForwardUp()
		movement_module.BackwardDown(move_direction.Z)
	else
		movement_module.ForwardUp()
		movement_module.BackwardUp()
	end
end)

uis.InputEnded:Connect(function()
	local move_direction = thumbstick.moveVector
	if move_direction == Vector3.zero then
		movement_module.LeftUp()
		movement_module.RightUp()
		movement_module.ForwardUp()
		movement_module.BackwardUp()
	end
end)

I don’t fork the input module - I manually enable it by requiring it. I’ll wait a bit before marking this as the solution in case someone comes up with something better.

1 Like

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