Is MouseButton1Click = Gui.TouchTap?

Quick question, does MouseButton1Click = Gui.TouchTap on mobile?

I’ve had a lot of problems with MouseButton1Up on mobile.

Edit: It seems like it, but I need confirmation before I permanently leave it on my code.

Edit2: Yes I have tried looking it up, but the Roblox wiki doesn’t say anything more about it. There are also no topics related to it.

1 Like

yes mousebutton1click means whenever it is clicked, that includes mobile

Does that mean that MouseButton1Click ~= to MouseButton1Up?

either one works :smiley:

You can use the Activated event to check whenever a button in a Gui is clicked, no matter if the player is on PC or Mobile. Make sure that the Active property of the GuiObject is set to True for this to work.

More info about the different properties & events in this topic can be found below, just in case using Activated doesn’t match the use case for your game:

TouchTap Event - Developer Hub Page

MouseButton1Click Event - Developer Hub Page

MouseButton1Up Event - Developer Hub Page

Active Property - Developer Hub Page


Active Property

  • This property determines whether a GuiObject will sink input to 3D space

It seems like it could work, both the wiki and the devforum post doesn’t clarify fully what inputs .Activate takes.

Never mind, the script takes TouchTap as an event handler

TouchTap Roblox wiki

  • Since this event only requires one finger, this event can be simulated in Studio using the emulator and a mouse. Below is an example of TouchTap being fired on a Frame that is GuiObject.Active

Only using MouseButton1Click will work, you don’t have to do the other part.

“Does that mean that MouseButton1Click ~= to MouseButton1Up” but == to GuiObject.TouchTap?

Tried and tested.

MouseButton1Click is essentially MouseButton1Up both on pc and on mobile. MouseButton1Click might have time.

The difference between MouseButton1Up and TouchTap is that MouseButton1Up will fire on mobile when releasing input regardless whether you intentionally meant to swipe or leave the gui button. That means if your finger is on the textbutton and you release that finger, that input will go through no matter what.

While TouchTap will take into consideration of that. If you put your finger on the textbutton for sometime and you release it; the input won’t go through.

MouseButton1Up is a problem on mobile because you can unintentionally click on a button when you didn’t mean to. (e.g. accidentally spending 90% of your ingame currency on something you didn’t want).

I thought this

if IsUserOnPc then
   TextButton.MouseButton1Up:Connect(. . .)
elseif IsUserOnMobile then
   TextButton.TouchTap:Connect(. . .)

was this.

TextButton.MouseButton1Click:Connect(. . .)

Apparently .Activated does actually work as a replacement. Just that the input object UserInputType.TouchTap is mistakened for Touch.

Edit: Nvm, it just wasn’t activating only when I was sliding my finger but it still works as a replacement.

1 Like

That makes sense – I also just realized something looking back at your previous post:

I took a look at the documentation of GuiObject’s events, and it turns out that while TouchTap works for quick inputs, TouchLongPress is intended for situations where the player holds the button/GuiObject down. I’m not sure if this will be useful or not (or if you already looked over the TouchLongPress event already) but I wanted to mention it just in case it comes in handy.

Unrelated note:

Also, since you just marked my post as a solution again, for some reason it shows that I edited the post today when I haven’t edited it since making that post (not sure if that’s a discourse bug).

1 Like

Yeah it seems to be showing that it’s edited for me to.

1 Like