MouseButton1Click doesn't work for mobile

Yes I did, I even looked in the explorer while testing if anything happened to the button or the localscript.

The solution is to use MouseButton1Down.

2 Likes

That doesn’t … change anything, all it does is mousebutton1click fires when you press the mouse button and its released, mousebutton1down fires when you press it down.

I know. However it does work. I was doing a gun system today and MouseButton1Click didn’t work on phones but MouseButton1Down did. MouseButton1Click wasn’t even firing somehow.

Try

MouseClick

or

Touched

Both of those are not for GUI’s.

This thread is also over a month old, however for people that search this in the future:

MouseButton1Click WILL work for pc, mobile, and xbox. It is an issue with your code if its not detected being clicked.

2 Likes

Hello, I solved this by increasing the ZIndex of my button. It now works fine!

2 Likes

Hello! If anybody’s still stuck on this, try to increase the ZIndex of the object.
If that doesn’t work then another reason might be because you have children in the button.
Try adding a button inside your object and increasing that button’s ZIndex, and use that for your MouseButton click event.

Hope this helped!

1 Like

I changed the Z index and it worked for me!

Also, try .Activated (I don’t think you have to but according to roblox MouseButton1Click is deprecated)

Where does it say that MouseButton1Click is deprecated?
https://developer.roblox.com/en-us/api-reference/event/GuiButton/MouseButton1Click

It doesn’t say it on the forums, But I feel like .Activated is more helpful

https://developer.roblox.com/en-us/api-reference/event/GuiButton/Activated

The API isn’t super helpful about .Activated but it still works the same! :smiley:

Okay so after browsing some forums I found out that .Activated is used mainly in scripts that control clicking buttons on mobile devices and MouseButton1Click - mainly for computers, that still doesn’t mean that it is better to use .Activated everywhere. Also MouseButton1Click is not deprecated.

  • I don’t think that it works the same since MouseButton1Click is used specifically for detecting left mouse button click.

What I would suggest you to do if your button script is meant to work differently on computers and mobiles is to use both functions in the same script.

Try a MouseButton1Down

A MouseButton1Down does the same thing as a 1Click, but it works better for mobile.
And a MouseButton1Down function works with both computers and mobile

I’ve already said it here, post 22: