PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

TouchTap

The TouchTap event fires when the player performs a tap gesture on the UI element using a touch-enabled device. A tap is a quick single touch without any movement involved (a longer press would fire GuiObject/TouchLongPress, and moving during the touch would fire GuiObject/TouchPan and/or GuiObject/TouchSwipe). It fires with a table of DataType/Vector2s that describe the relative positions of the fingers involved in the gesture.

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 TouchTap being fired on a Frame that is GuiObject/Active. Below, the event fires when the cursor briefly pauses (to simulate a tap) and the Frame toggles its GuiObject/BackgroundTransparency. The code for this can be found the code samples.

TouchTap being fired on a Frame using Studio's emulator

This event is part of a family of touch-related events. Other events like this one are GuiObject/TouchSwipe, GuiObject/TouchRotate, GuiObject/TouchPinch, GuiObject/TouchPan and Guiobject/TouchLongPress. In addition, UserInputService has a similarly named event that is not restricted to a specific UI element: UserInputService/TouchSwipe.

Parameters

Name Type Default Description

An array of DataType/Vector2 that describe the relative positions of the fingers involved in the gesture.


Code Samples


Tap Transparency Toggle

This code sample will toggle the GuiObject/BackgroundTransparency of a UI element, like a Frame, when it is tapped on a touch-enabled device.