TouchSwipe
The TouchSwipe event fires when a user swipes their fingers on a UserInputService/TouchEnabled|TouchEnabled
device.
This event can be used to determine when a user swipes their fingers on the screen of their device and the direction that the user swiped.
For more precise tracking of touch input movement, use using UserInputService/TouchMoved
To check if a user’s device is TouchEnabled, and that touch events will fire, see UserInputService/TouchEnabled
.
This event only fires when the Roblox client window is in focus. For example, inputs will not be captured when the window is minimized.
As this event only fires locally, it can only be used in a LocalScript
.
See also
UserInputService/TouchTap
UserInputService/TouchTapInWorld
UserInputService/TouchLongPress
UserInputService/TouchMoved
UserInputService/TouchPan
UserInputService/TouchPinch
UserInputService/TouchRotate
UserInputService/TouchStarted
UserInputService/TouchEnded
Parameters
Name | Type | Default | Description |
---|---|---|---|
|
An `Enum/SwipeDirection, indicating the direction the user swiped |
||
|
Number of touches (e.g. fingers) involved in the gesture |
||
|
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, |
Code Samples
Touch Swipe a GUI
The example below demonstrates the UserInputService/TouchSwipe|TouchSwipe
event by GuiObject/TweenPosition|tweening
a GuiObject|GUI
element’s position 100 pixels in the direction of the swipe according to the value of the Enum/SwipeDirection|swipeDirection
argument.
In order for this example to work as expected, it must be placed in a LocalScript
that is parented to the gui being swiped.