Updating TouchSwipe & Introducing TouchDrag Next Week

Hi Creators!

We’re excited to announce that next week, we’ll be updating our TouchSwipe API and releasing a new TouchDrag API! Our goal is to support consistent input interfaces to unlock player interaction within your experiences.

:sunny: What’s changing?

Previously, the TouchSwipe API exhibited inconsistent behavior between touch-based Android and iOS devices by default, which was unintended. With this update, TouchSwipe will behave consistently across all devices, and we’ve added a new TouchDrag API to support additional touch behaviors.

:sound: What do you need to do?

If you are currently using TouchSwipe within your experience, there is no work needed on your end; this update should be similar to a bug fix. If you are not, we encourage you to check out both TouchSwipe and TouchDrag if they make sense for your experience. Please let us know if you spot any additional inconsistencies!


APIs

TouchSwipe and TouchDrag are both part of UserInputService, Roblox’s service that detects and captures the different types of input available on a user’s device. TouchSwipe and TouchDrag are both triggered on TouchEnabled devices, such as supported mobile phones and tablets.

TouchSwipe

Many of you may already be familiar with TouchSwipe and use this API in your experience! The TouchSwipe event fires on a TouchEnabled device when a user places their finger(s) down on the screen, pans across it, and lifts their finger at a certain speed. This event is used to detect these swipe gestures and the direction of the swipe.

Property Description
swipeDirection: Enum.SwipeDirection An Enum.SwipeDirection, indicating the direction the user swiped.
numberOfTouches: number Number of touches (e.g. fingers) involved in the gesture.
gameProcessedEvent: bool Indicates whether the game engine internally observed this input and acted on it. Generally this refers to UI processing, so if a button was touched or clicked from this input, gameProcessedEvent would be true. This is also true for input events connected via ContextActionService.

TouchDrag

The TouchDrag event fires on a TouchEnabled device when a user places their finger(s) on the screen and begins panning at a certain speed. The event is triggered the first time this speed is exceeded, even if the user has not lifted their finger yet. This event is useful for detecting the start of a directional drag gesture, allowing you to track finger movement along a specific axis.

TouchDrag can be used alongside TouchSwipe. For example, in a music app, TouchDrag could be used to detect when a user horizontally drags on a song to reveal context actions. Meanwhile, TouchSwipe could track the user’s finger fling to add the song to their queue.

The API for TouchDrag has been kept identical to TouchSwipe for compatibility and familiarity.

Property Description
swipeDirection: Enum.SwipeDirection An Enum.SwipeDirection, indicating the direction the user swiped.
numberOfTouches: number Number of touches (e.g. fingers) involved in the gesture.
gameProcessedEvent: bool Indicates whether the game engine internally observed this input and acted on it. Generally this refers to UI processing, so if a button was touched or clicked from this input, gameProcessedEvent would be true. This is also true for input events connected via ContextActionService.

What’s Next

  • Unifying the other Touch APIs: We’re working on creating consistent behaviors across all touch-related APIs within UserInputService. Stay tuned for more updates, and let us know if there are any other bugs you spot!
  • Applying these changes to GuiObjects: We will be applying these same changes to the built-in touch functionality within GuiObjects.

:blue_heart: Made with love

Special thanks to @PotionSeller33, @NoUniqueAddress, @merlin_codes, and @MetaVars for their hard work on this feature! :clap:

116 Likes

This topic was automatically opened after 10 minutes.

This is going to be useful for my game (specifally since it’s for all devices, not just mobile)

now imagine doomscrolling in roblox…

13 Likes

These changes sound really cool! Making the touch APIs in UserInputService work the same way everywhere will make things so much easier for us. It’s great that Roblox is fixing this!

And adding these changes to GuiObjects too? Even better! Can’t wait to see how much smoother everything gets.

4 Likes

Gonna be amazing for my upcoming game :fire::fire:

4 Likes

Good update! Would be nice to have a way to test multi touch in studio, eg for zooming.

4 Likes

Will there be multi touch support?

2 Likes

That’s definitly useful for a lot of drag and fling actions on mobile and with the expanded support for GuiObjects and the consistency improvements across different devices I might give this a try in such cases.

2 Likes

Hey @Vexcent77, we currently have trackpad gestures on supported laptops, and you can use our Touch APIs to support multi-touch on mobile! We’re currently working on improvements to support more platforms – stay tuned here.

3 Likes

Yes!! Thanks Roblox! Finally great update

2 Likes

Could you please implement a way for us to detect if the touch gesture was on the thumbstick or not?
I think this is a crucial feature that’s missing.

3 Likes

Thank you!! I remember last time I implemented touch swipe/drag having to work around many related issues. Especially not being to easily distinguish CoreGui touchpad drags vs legitimate ones.

2 Likes

Will this support Touchpad for Play-Station Controllers?

Are these functions coming to the mobile device emulator any time soon?

thats nice and all but, how about this bug with UI Drag Detectors?

https://devforum.roblox.com/t/ui-drag-detector-doesnt-behave-in-mobile/3266399