I was wondering if there was a way to disable mobile controls (move and jump) and re-able them later? I set the players jump and walkspeed to 0 and it seemed to remove the jump button but the walk button is still in the way.
The reason I want to disable it is because they get in the way of my menu screen and buttons on the menu screen. So I wanna have the buttons disable while they’re in the menu screen and re-enable them when they leave the screen
You have have to wait for the client to load the CoreScripts first before you can set the Modal State. Try waiting around 1/30 of a second before firing that command.
So it actually turns out that the documentation is incorrect. UserInputService.ModalEnabled = false will hide the Mobile interface, and UserInputService.ModalEnabled = true will show them.
Excuse me for the bump but it seems UserInputService.ModalEnabled doesn’t work. And even if it did work it only hides the Mobile controls, not disable them.
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
RunService.RenderStepped:Connect(function()
if UserInputService.TouchEnabled then
if Player.PlayerGui.TouchGui.TouchControlFrame:FindFirstChild("DynamicThumbstickFrame") then
Player.PlayerGui.TouchGui.TouchControlFrame.DynamicThumbstickFrame:Destroy()
end
Character.Humanoid.WalkSpeed = 0
Character.Humanoid.JumpPower = 0
end
end)
This should disable all movement for a player in mobile