Mobile control GUI not showing up

I am working on a game and one of my friends reported that a mobile control GUI wasn’t showing up. No matter what it would not display its contents.

Here is my code:

-- device telling variables
local isComputer = (userInputService.KeyboardEnabled and not userInputService.TouchEnabled) and true or false
local isXbox = guiService:IsTenFootInterface() and true or false
local isMobile = ((not isComputer) and (not isXbox)) and true or false
-- mobile controls stuff
if isMobile then
	local currentModeString = tostring(currentMode)
	local lastModeString = tostring(currentMode - 1)
	local currentControl = mobileControls:FindFirstChild(currentModeString)
	local lastControl = mobileControls:FindFirstChild(lastModeString)
	local thirdControl = mobileControls:FindFirstChild("3")

	if currentControl then
		currentControl.Visible = true
	if lastControl then
		lastControl.Visible = false
		thirdControl.Visible = false
        -- ignore this, this is just for debugging purposes
	print(currentControl.Visible, lastControl.Visible, thirdControl.Visible)

Any help would be appreciated : )

can you check if the isMobile boolean equal to true?

I playtested with a mobile device and it returned true

im assuming mobileControls is in reference with the mobile controls gui. that you have. maybe try doing waitforchild? it could be that it isn’t loaded in time.

Looked more into my code and I made a mistake, I disabled the entire main gui instead of disabling stuff that’s not the mobile controls. my fix

for _, guiObj in pairs(mainGui:GetChildren()) do
	if guiObj ~= mobileControls then
		if guiObj:IsA("GuiObject") then
			guiObj.Visible = --whatever state

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