79535676

Date: 2025-03-26 07:25:44
Score: 1
Natty:
Report link

It sounds like your function is being triggered on both the InputBegan and InputEnded events. To ensure the function only triggers once when the button is pressed, you should check the inputState parameter in the function, and only execute your code when inputState is Enum.UserInputState.Begin.

Here's how you can do it:

lua

CopyEdit

localContextActionService = game:GetService("ContextActionService") local function onButtonPress(actionName, inputState, inputObject) if inputState == Enum.UserInputState.Begin then print("Button Pressed!") -- Replace this with your desired action end end ContextActionService:BindAction("MyButtonAction", onButtonPress, true, Enum.UserInputType.Touch)

Explanation:

This will ensure the function is only called once when the button is pressed, not when it's released.

Reasons:
  • Contains signature (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Ram