ContextActionService bug

Okay basically whenever you have two binded actions it seems to stop one and continue to run the other? I don’t know if this is a bug or if this is expected behavior.

local actionServ = game:GetService'ContextActionService'

function bindOne()
	print"Should print"
end

function bindTwo()
	print"Should also print"
end


actionServ:BindAction("testOne", bindOne, false, Enum.UserInputType.MouseButton1, Enum.UserInputType.Touch)
actionServ:BindAction("testTwo", bindTwo, false, Enum.UserInputType.MouseButton1, Enum.UserInputType.Touch)

Is it like as soon as you bind it, the newest bound function fires?

Yea, I don’t know if this is intentional or not… If it is intentional then what the heck is the point of naming them?? Also it makes it harder for new time people to seperate the binded actions into seperate scripts

Any word on this?

Yeh, I experience this.

This is intended. ContextActionService is designed as a stack. The most recently bound function will be the one that is fired. This is how it is supposed to be used, like normally the X button reloads your gun but if you’re in front of a door then it’s to open the door, etc.

No David, it is fired when it is bound.

Ok, thank you for the reproduce case. We’re looking into it and should have a fix soon.

So this is actually intended behavior.

If you notice this only happens when the second bound function uses the same input as the first. This is because we call the first function with a Enum.UserInputState.Cancel to inform the first function that it is no longer active, so it can do any clean up it needs to do (like if you are using it to move the character, you might want it to stop that when something else takes over that input). I updated the wiki tutorial to explain this better, also added a gamepad example for anyone curious.

I’ve also edited the UserInputState wiki page to have some info.