The TouchLongPress event fires after a brief moment when the player holds their finger on the UI element using a touch-enabled device. It fires with a table of
DataType/Vector2 that describe the relative screen positions of the fingers involved in the gesture. In addition, it fires multiple times with multiple
Enum/UserInputStates: Begin after a brief delay, Change if the player moves their finger during the gesture and finally with End. The delay is platform dependent; in Studio it is a little longer than one second.
Since this event only requires one finger, this event can be simulated in Studio using the emulator and a mouse. Below is an example of TouchLongPress firing on a Frame that is
GuiObject/Active. Below, the event fires after a brief delay (Begin) and then continually as as the finger is moved (Change). It fires one last time after it is released (End).
This event is part of a family of touch-related events. Other events like this one are
GuiObject/TouchSwipe. In addition,
UserInputService has a similarly named event that is not restricted to a specific UI element:
An array of
Move UI Element with TouchLongPress
This code sample allows the player to manipulate the screen position of some UI element, like a
Frame, by holding down on the UI element for a brief moment. Then, the player moves their finger and releases. During the gesture the Frame is colored blue with a white outline.