GuiTouchPan

Constructor:

GuiTouchPan(Touch.position, pandistance, panspeed, touchState)

Description

This event is triggered when a finger moves on the GUI object.

Parameters

Name Type Description
Touch.position Vector3 Coordinates of touch point
pandistance Vector3 Pan distance
panspeed float Pan speed (pixel/second)
touchState Enum.UserInputState Input type state

Examples

Add the following client script under ClientfirstLogic. Start the game. Touch on the mobile phone and move the finger. 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.GuiTouchPan:Connect(function(pos,dir,speed,state) -- the event of finger moving on the UiButton
    print("Move a finger on the button")
    print(tostring(pos))
    print(tostring(dir))
    print(tostring(speed))
    print(tostring(state))
end)
uipanel.GuiTouchPan:Connect(function(pos,dir,speed,state) -- the event of finger moving on the UiPanel
    print("Move a finger on the interface")
    print(tostring(pos))
    print(tostring(dir))
    print(tostring(speed))
    print(tostring(state))
end)