How to disable the jump button and joystick on mobile?

Hey! I’m looking for the best way to disable the mobile jump button and joystick. I’ve seen other topics on this but I haven’t found an official way.

Thanks!

3 Likes

https://developer.roblox.com/en-us/api-reference/property/UserInputService/ModalEnabled

1 Like
if script.Parent:FindFirstChild("TouchGui") then
	script.Parent:WaitForChild("TouchGui").Parent = game.ServerStorage
	end

This script works the best for me. It is located in starter GUI and is a local script. It checks if the player is on mobile by checking if the player has a “TouchGui”. It moves the touch gui to another parent, for this case ServerStorage. You can get the mobile controls back by simply referencing the same place and setting the parent of TouchGui to its correct parent. (PlayerGui)

1 Like

This is a deprecated feature. Is there a new function for this?

This would work but it feels kind of hacky.

I’m looking for a built in function to use if possible

Although it has been marked as deprecated, it still works.

1 Like

To my knowledge, there is no built in function to disable mobile controls.

1 Like

I am not a fan of using deprecated features, they’re deprecated for a reason…

I fail to believe theres no up-to-date function for disabling mobile controls ui :confused:

I’m going to search google again to see if I can find an answer

1 Like

Think of it like this, the mobile controls is a GUI located inside of the player’s GUIs. There wouldn’t just be a function to disable a single GUI, there’s not a single built in function like that.

See I have a similar thing against it as I want the default Starter Player and Starter Character scripts to not replicate automatically

So after searching through the PlayerModule under PlayerScripts, I’ve found a function for disabling controls which also disables the UI on mobile, and it works like a charm.

local Player = game.Players.LocalPlayer
local PlayerModule = require(Player:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule"))
local PlayerControls = PlayerModule:GetControls()
PlayerControls:Disable()

Make sure you wait for the player to be fully loaded before disabling this else it doesn’t seem to work.

5 Likes

So the function would begin upon CharacterAppearanceLoaded()?

I’ve never used that function actually…

For me, inside of my main client script I have a function that waits until the game is completely loaded and the character loads:

function waitUntilGameLoaded()
	if not game.Loaded then
		game.Loaded:Wait()
	end
	if not Player.Character then 
		Player.CharacterAdded:Wait()
	end	
end
1 Like

Ohhhh ok! I get what you’re saying, the default game environment you get when doing the first load, it waits for everything currently occupying

game:GetDescendants() --- since it's all in game this is an example

to load first! Right?

https://developer.roblox.com/en-us/api-reference/event/DataModel/Loaded

Datamodel is just another term for game

2 Likes