The TouchRotate event fires when the player uses two fingers to make a pinch or pull gesture on the UI element using a touch-enabled device. Rotation occurs when the angle of the line between two fingers changes. This event fires in conjunction with
GuiObject/TouchPan. This event is useful for allowing the player to manipulate the rotation of UI elements on the screen.
This event fires with a table of
DataType/Vector2 that describe the relative screen positions of the fingers involved in the gesture. In addition, it fires several times with multiple
Enum/UserInputStates: Begin after a brief delay, Change when the player moves a finger during the gesture and finally once more with End.
Since this event requires at least two fingers, it is not possible to be simulated in Studio using the emulator and a mouse; you must have a real touch-enabled device (and also least two fingers, try asking a friend).
A Lua array of
A float indicating how much the rotation has gone from the start of the gesture
A float that indicates how quickly the gesture is being performed
This code sample is meant for a
LocalScript within an inner
Frame that is inside an outer
Frame, or other
GuiObject. It allows the player to rotate the inner frame by performing a
GuiObject/TouchRotate gesture on the outer frame.