Is there a way to check if the player is typing whenever the BindAction() runs? Something like the 2nd argument “gameProcessed” in the UserInputService
Hi!
I’m pretty sure ContextActionService takes care of that scenario automatically.
(ContextActionService, 2021-03-30)
EDIT @mikeyaboii3 @dthecoolest
Turns out the above information on Dev Hub is correct (unless there are any bugs). Checking input state is almost ALWAYS necessary, since different use of ContextActionService detection doesn’t seem to be a wise use. There are three arguments passed with action call: action name, input state, and input object.
local CAS = game:GetService("ContextActionService")
local function actionHandle(actionName, inputState, inputObject)
if (inputState == Enum.UserInputState.Begin) then
print("DETECTED")
end
return Enum.ContextActionResult.Pass -- sink or pass action
end
CAS:BindAction("SampleBinding", actionHandle, false, Enum.KeyCode.T)
2 Likes
This is pretty interesting, @EssenceExplorer looks like it doesn’t this is what I thought initially as well.
here is the solution though, checking the user input state:
1 Like
Ah I am sorry, turns out the ContextActionService was inside of a UserInputService
1 Like