• Studio

  • Studio API

  • Bots

  • Web API

  • Designer Resources

  • Host Resources

  • TapHandler

    Inherits from: Behaviour

    A TapHandler is a class that can be used to detect when a GameObject has been tapped. For a GameObject to be tapped, it must have a Collider component attached to it.

    Properties

    Called when the GameObject is tapped.

    -- Connect to the Tapped event
    self.gameObject:GetComponent(TapHandler).Tapped:Connect(function()
        print("Tapped")
    end)
    

    moveTo

    boolean

    Moves the GameObject to the specified position when it is tapped.

    -- Move the GameObject to the specified position when it is tapped
    self.gameObject:GetComponent(TapHandler).moveTo = Vector3.New(0, 0, 0)
    

    distance

    number

    The distance the GameObject will move when it is tapped.

    -- Set the distance the GameObject will move when it is tapped
    self.gameObject:GetComponent(TapHandler).distance = 1
    

    Methods

    Performs the tap action on the GameObject. This method is called when the GameObject is tapped.

    -- Perform the tap action on the GameObject
    self.gameObject:GetComponent(TapHandler):Perform()
    

    Returns

    void

    Updated 2 months ago

    PocketWorlds Icon

    © 2024 Pocket Worlds. All rights reserved.