Prevent mobile move button from triggering TouchMoved

I am trying to implement mobile support into my game and I am finding it difficult to implement events such as TouchMoved and TouchStarted.

  1. What do you want to achieve?
    What I want to achieve is when the player holds their finger and drags it on the screen a variable will turn to true allowing the player to steer a vehicle.

  2. What is the issue?
    The issue is with the Context Action Service buttons and the movement stick button on the left corner of the screen. When tapping the Context Action Service button or dragging the stick (I’m not sure what it’s called) these set off the TouchMoved and TouchStarted events. This isn’t ideal as it causes the player to steer in that direction which is usually the bottom left or right corners of the screen. These two things being tapped on need to be filtered out.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve searched everywhere and I’m not sure if I just don’t know how to word this problem correctly or maybe this is a super easy fix. But, I’ve done my research and the best thing I’ve come up with is a band aid fix.

local UIS = game:GetService("UserInputService")
local steerable = false

function Steer()
    --Function for vehicle steering

    if not steerable then
        steerable = true

UIS.TouchMoved:Connect(function(inputObj, gameProcessedEvent)
    if not gameProcessedEvent then
         if steerable then

    if steerable then
        steerable = false

What the above code aims to do is IF the player has tapped in the world, then allow the player to steer the vehicle. This filters out any taps for the context action buttons or mobile movement stick buttons. However, this doesn’t always work as intended as you could imagine. Even if the player taps in the world and then taps another button with their other finger the same issue still occurs.

I’m absolutely stumped because I feel like this is an easy fix. Maybe I’m just using the API incorrectly. Either way, I appreciate your support and help!

1 Like

Bump. I still haven’t found a reliable solution to this issue.