How do I change the mobile UI's ZIndex?

I have UI that blocks the mobile movement UI so I tried to change the ZIndex of the mobile UI. However, my script didn’t quite work. There are no errors or anything meaning the ZIndex does exist here.

Script:

if Player:FindFirstChild("PlayerGui"):FindFirstChild("TouchGui") then
	local TouchUi = Player:FindFirstChild("PlayerGui"):FindFirstChild("TouchGui")

	print("Touch UI found")
	
		local TouchControlFrame = TouchUi.TouchControlFrame
		
		TouchUi.ZIndexBehavior = Enum.ZIndexBehavior.Global

		TouchControlFrame.ZIndex = 99
		else
			print("No touch UI found")
end

Any help is appreciated. Thank you! :smile:

You actually can’t bump the default touch controls, ZIndex from PlayerGui as they live in CoreGui and always draw on top.

there is the option of hiding the default touch GUI and making your own via StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)) and drawing custom buttons with whatever ZIndex you like
( or you could lower your own UI ZIndex so the built-in sits above it )

Apologies, thank you @riblolox for correcting me.

This is not true. Believe it or not, the mobile touch GUI is actually located under PlayerGui. Its a ScreenGui called “TouchGui”

1 Like

The reason this doesn’t work is because ZIndex only works for all instances or siblings under the ScreenGui (depending on what you set it to.). What you need to do is set DisplayOrder of TouchGui to 100, or higher than your UI’s display order.

1 Like