Mobile shoot button

Hey guys,
I’m having a bit of an issue using MouseButton1Down (UI) on mobile.
I’m making a shooter game and if they use the shoot button for automatic guns I use MouseButton1Down and MouseButton1Up to see if they’re holding down the button, but if you slide your finger off the button instead of directly lifting it MouseButton1Up doesn’t fire.
Do you guys have any suggestions for workarounds / different service I could use to achieve what I want?

Use 2 connections for the same function - one with the MouseButton1Down and one with TouchTap/TouchStarted.

Not sure I understand… how would I combine those two to get the result?

local function ShootingFunction()


I want it to only shoot when they use the shooting button on mobile though, not anywhere on the screen
also how would that give me the functionality of holding down the button to shoot?

Take a look at TouchTap and TouchLongPress

Ok so,
TouchLongPress turned out to kind of work, the issue is it starts after like a few seconds delay…
I would want the button to feel responsive and fast

TouchStart + TouchEnd.

Set a boolean that is false at first.
When you press the button - boolean goes true and task.wait(time you want to delay before shooting starts).
If after the task.wait the boolean is still true then start shooting until boolean is false.
That same button - connect also to TouchEnded, so when the touch ends the boolean is set to false.

Hope it helps.

1 Like