GuiTouchSwipe

Constructor:

GuiTouchSwipe(touchMoveDir, touchCount)

Description

This event is triggered when one or more fingers swipe on the GUI object.

Parameters

Name Type Description
touchMoveDir Vector2 Swipe direction
touchCount int The number of touch points

Examples

Add the following client script under ClientfirstLogic. Start the game, and swipe the GUI object on the mobile phone. Observe whether the event is triggered or not.

wait(1)
local uipanel = RWObject.Create("UiPanel") -- create a UiPanel
local uibtn = RWObject.Create("UiButton") -- create a UiButton
uibtn.Parent = uipanel -- set the parent of the created UiButton to the new created UiPanel
local person = Players:GetLocalPlayer() -- retrieve the player
uipanel.Parent = person. GameUI -- Set the parent of the UiPanel as GameUI
uibtn.TouchSwipe:Connect(function(touchMoveDir,touchCount)  -- register the event of swipe for the UiButton
      uibtn.ImageColor = Vector3.New(255,0,0) -- the button turns red
    print("Swipe direction:" ..tostring(touchMoveDir).."     ".." The number of touch points:" ..touchCount)
end)