GuiInputBegan

Constructor:

GuiInputBegan(inputobject)

Description

This event is triggered when the user input (e.g. mouse, touch pad, keyboard, etc.) starts.

Parameters

Name Type Description
inputobject RWObject Input object

Examples

Add the following client script under ClientfirstLogic. Then touch on the mobile phone and 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.GuiInputBegan:Connect(function(inputobject) -- the event of starting input is triggered on the UiButton
    print("Start inputting")
    print(tostring(inputobject.UserInputType))-- print the input type
    print(tostring(inputobject.UserInputState)) -- print the input state    
end)
uipanel.GuiInputBegan:Connect(function(inputobject) -- the event of starting input is triggered on the UiPanel
    print("Start inputting")
    print(tostring(inputobject.UserInputType))-- print the input type
    print(tostring(inputobject.UserInputState)) -- print the input state    
end)