Detect mobile user dragging or clicking

Alright so I’d like to be able to know when the user is clicking its mouse, the only problem is that mobile players when zooming or moving their camera it was detected as a click. How could I approach this?

I suggest use the UserInputService since it has a different outcome between Mouse and Touch.

UserInputService.InputBegan:Connect(function(input)
     if input.UserInputType == Enum.UserInputType.MouseButton1 then
          --only sent by mouse
     elseif input.UserInputType == Enum.UserInputType.Touch then
         -- sent by a mobile player
     end
end)

Hi, this doesn’t fix my problem, I was looking for a way to only detect when the user clicked, not whether he was on a mobile device or pc, thanks though

It’s been quite a few months and still no response here. Have you solved your problem? I’m saying this because I’m on a similar situation and need help.

Sadly no, hopefully someone else finds a solution to it

Umm I believe just doing

local Player = game.Players.LocalPlayer

local Mouse = player:GetMouse()

local Holding = false

Mouse.Button1Down:Connect(function()

 Holding = true -- or do any other code here

end)

Mouse.Button1Up:Connect(function()

 Holding = false

end)

works on mobile

1 Like