[Solved] How do stop an action if something is true

So I am making a top-down shooter game so when the character collides with the gun, the gun gets deleted and the gun gets equipped to the character inventory [which changes animations]
so if there are multiple guns on the floor all of them get deleted when walking on them, so how do I make an if statement so [if current animation set to = 2 then cancel the action that’s replaces the gun]