Simple code not performing on mobile by any means

Hey, so I have no idea why this is happening, but apparently, even though the code changes the Baseplate’s color when I play on mobile, none of the buttons do anything when I click them, here’s my code:

for i,t in pairs({shop_buttons:GetChildren(), frame_buttons:GetChildren()}) do
	for i2,b in pairs(t) do
		if b:IsA("ImageButton") then
			game.Workspace.Baseplate.BrickColor = BrickColor.Random()
				if b.Parent.Name == "Buttons" then --Check to see if the button is a shop category
					if b.Name == "Close" then
						shop_frame.Visible = false
				else --If not, it must be a regular frame button

Some brief background as to what this is, it basically connects each shop button to a clicked function that’ll update the selected shop frame. Ex: If I click on Coins, it’ll make the Coins frame visible for me, and so on…

I’m borderline ready to blame the Roblox game engine for this one, as I have by no means any clue as to why this might be happening. Works perfectly on PC, but for all mobile testing I’ve done it has not once worked. Any help appreciated, thanks.

Try ImageButton.MouseButton1Down() instead of ImageButton.Activated(). MouseButton1Down() is actually my goto for this kind of input.

You should also file a bug report because I think that’s unintended behavior. .Activated() should work on mobile.

1 Like

This is very strange though, I’ve used the Activated event on all of my other UI elements and all of it did work for me on mobile, this is the only exception, and I do believe that several of the functioning ones were also the same class as these ones (ImageButtons)


You should do a print test beneath b:IsA(“ImageButton”) to determine if the b.Activated line is actually being reached.

Otherwise, I don’t know what to tell you.

1 Like

Make sure there are no invisible UI elements with a Z-Index higher than the button. I had the same issue and fixed it by changing my ScreenGui’s ZIndexBehavior to Sibling. Before I did this, some buttons would work on all platforms but mobile.

More information can be found in the replies of this post: Some Mobile players unable to interact with guis in my game - #8 by darthskrill