How to make ContextActionService not fire when input ended?

I’m using ContextActionService to fire a function when a key is pressed, but the problem is that ContextActionService fires the same function again after the input has ended.

How can I make it so ContextActionService is only firing functions when the Input has began?

1 Like

You can use UserInputService instead.

1 Like

You can simply use the 2nd return of a ContextActionService function which is a UserInputState and check if the state is Begin

local function thing(actionName, actionState)
   if actionState == Enum.UserInputState.Begin then
       --COde
   end
end

Where thing is the function bound via BindAction

9 Likes