How do I hide mobile controls when a certain GUI is up?

Sometimes I try to make mobile controls a GUI is up and it doesn’t work. I have looked in PlayerGui and disabled the mobile controls but that fully disappeared the controls and couldn’t move. I tried using a .Parent after the thing was disabled, but then it just got rid of the mobile controls after that.

This script is when a player clicks a certain GUI, then the mobile controls appear again. I used a = False statement to make them appear again but they were still gone as well. This is frustrating when you are making a script. What the script was supposed to do is that mobile controls were disabled when a GUI was enabled, after that when the player clicks a TextButton, then the controls appear again. This is a very clever struggle whenever you are trying to make any GUI without the controls in your way, but it doesn’t come out well.

1 Like

This isnt a ui design problem it is a scripting one please change the category

We cannot really help you with this situation if you don’t provide any block of code which we can arrange for functionality

Heres part of it:


when game.StarterGui.MenuGui.MenuFrame.Transparency.0 = true do

game.PushControls.Transparency = 0

game.StarterGui.MenuGui.MenuFrame.MouseButton1Click = true then

function(click)

MouseButton1Click.Clicked = true then

game.PushControls.Transparency = 0

Your code is incorrect, it is not in relevance with any of Roblox’s Lua API. Apparently you have not learnt much about scripting yet and you are just tackling and guessing it. You shouldn’t be doing too much complicated things like these.

Just an empty function?
They should actually use this code (in a localscript ofc)

wait(1); -- Make sure you don't run it before CoreScripts are done loading
local UserInputService = game:GetService('UserInputService');
local function changeControls(ControlsEnabled)
     UserInputService.ModalEnabled = ControlsEnabled;
end;

To use it, just use changeControls(true) to enable controls and changeControls(false) to disable it. Make sure its in the same script or it wont work

3 Likes

Please help me, as this will make my game’s main menu bad and i don’t want the controls getting in the way of the gui and then it will make it look out of place for the menu GUI. I have seen this on many games with main menu’s and the mobile controls are clearly hidden there, but after the player clicks the play button, then the mobile buttons appear again.

Each part of your code is incorrect. It has nothing related to Lua at all and is not the correct syntax.
I suggest watching some YouTube tutorials and learn. Channels I recommend:

1 Like

couldn’t find anything on youtube for the mobile controls. This is pretty bad now that i couldn’t find any other posts on the devforums that made sense to me, I want this to be a feature on hiding mobile controls when certain gui are up because this is struggling me for now that i found absolutely no answers for this solution so far.

There shouldn’t be an exact video on this topic, you need to learn the API and syntax to then create it yourself.

1 Like