How do I tell if a mobile player tapped inside of the mobile move pad or not?

I’m using player:GetMouse().Button1Down to detect when the player clicks or taps to perform an action. However, on mobile, when players tap to move around this also triggers the action which I don’t want. I’m looking for something like this made up TappedToMove boolean.

player:GetMouse().Button1Down:Connect(function()
    if not TappedToMove then
        -- action
    end
end)
1 Like
game:GetService("UserInputService").TouchStarted:Connect(function()
	Tapping = true
end)

game:GetService("UserInputService").TouchEnded:Connect(function()
	Tapping = false
end)


game:GetService("RunService").Heartbeat:Connect(function()
	if not Tapping and 
		not (game:GetService("Players").LocalPlayer.Character.Humanoid.MoveDirection.Magnitude > 0) then
		-- Run
	else
		-- Don't run
	end
end)


This might be a cheap solution (unsure if there’s an official way to go about it), however this should work. Unless I’ve completely misunderstood what you initially meant, this essentially just checks if the player is tapping on their touch device and moving at the same time (replicating the issue you described).

1 Like