GUI's Not Compatible with Mobile...?

Hello, I have been trying for the past week to figure out why my Inventory GUI Won’t open on Mobile (Works on PC) I do NOT Know how to script so I honestly have 0 Idea on how to fix this issue, Below is the script i’m using for the open function…

script.Parent.MouseButton1Click:Connect(function()
	if script.Parent.Parent.HatsFrame.Visible == false then
		script.Parent.Parent.HatsFrame.Visible = true
		script.Parent.Parent.COLOR.Visible = true
		script.Parent.Text = "Hats - On"
	else
		script.Parent.Parent.HatsFrame.Visible = false
		script.Parent.Parent.COLOR.Visible = false
		script.Parent.Text = "Hats - Off"
	end
end)

Hopefully This will be resolved soon…

1 Like

Hmm MouseButton1Click always works for me when I test my game on my phone.
Edit: gimme a sec I’m going to test this script in my studio.

Alright, Thank you, People are telling me on discord it’s correct also

Also what device are you testing this on?

Are you sure that this isn’t a positioning issue? If you’re positioning your UI using offset, it might seem like its properly working on pc but might be off screen for mobile. Make sure your using scale and or a mix between both

My friend tried it on Samsung, And I tried on Apple Iphone

I never thought about that, That could be the Issue

Look in the size property of each gui this might be a pain but it will help you a lot look in the size property of each gui click the pop down and set the offset on x and z to 0

How do you know that this program has been stolen?

I never said it was stolen but it probs was just copied from a yt video that is helping no one by telling them how to fix it.

I missed this, apologies. I believe the reason this is occuring is the reason that @Ze_tsu stated.

Well I do know how to edit a limited amount of scripts, just not to make an entire function

(post withdrawn by author, will be automatically deleted in 1 hour unless flagged)

Although its not proper practice, MouseButton1Click does work on mobile similar to touch tap and Activated.

1 Like

It’s probably the positioning then. To test the positioning, enable your UI in studio, go to Test section then the device icon and select a mobile device. If you can’t see it then you’re positioning it wrong.

UIs have not the same offsets on all screens, and you may need to adapt your UI Position.

UIAspectRatioConstraint May need the thing you need
Or look for plugins that could help: [Plugin] AutoScale Lite for GUIs - Scale your UI

2 Likes

I get very confused between elseif and else, but doesn’t else run a script after something else was true? And if not ignores it? Pretty sure elseif would check to see if the GUI is open, then close it if it is, like the script has done for the first if statement, only the first statement made stuff visible.

Then again, this might not even matter, and I could be wrong.

Try switching else to elseif and using the same statement, but switching ‘’== false then’’ to ‘’== true then’’