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)
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)
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 3 months ago