Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to use TouchSwipe?

Asked by 9 years ago

I'm not sure how to use TouchSwipe help?

1 answer

Log in to vote
0
Answered by 9 years ago

TouchSwipe returns 3 arguments. SwipeDirection, NumberOfTouches and GameProcessedEvent.

SwipeDirection is which way the user swiped (e.g Right, Left, Up, Down, None). NumberOfTouches is how many fingers were held down. GameProcessedEvent returns true if the user swiped in the menu, chat or anything that is handled by the CoreScripts.

This is a simple usage of it:

game:GetService("UserInputService").TouchSwipe:connect(function(swipeDirection, numberOfTouches, GPE)
    if GPE == false then --Code will only run if you didn't swipe in the menu, chat or anything handled by the CoreScripts.
        if swipeDirection == Enum.SwipeDirection.Up then
            print("User swiped up!")
        end
    end
end)

This code is tested and working.

Ad

Answer this question