It works anywhere in the scene because your dispenser is colliding with tiles (probably.) or another actor. Then, because it is colliding, it run the blocks inside the "When colliding".
You need to run the routine in your "when this collides" ONLY if the group of the colliding actor is equal to what you need, in your case the player. You could do on IF block to check the group of the actor. Then another IF within that one, and check the key press in there. AN AND statement in 1 IF block should also works.
You already have an IF above, but the problem in it is that you check THIS actor colliding shape, and not the COLLIDING's ACTOR group.