This question already has an answer here:

I'm running a SMP server, and I want to add a ticketing functionality. I have a villager that sells a "ticket" (paper w/custom name). Is there a way so that when the player walks through a doorway entrance, it triggers a tellraw message, and on onclick the item is removed from their inventory and a scoreboard value is incremented? The logic seems simple enough, but I don't want it accidentally mixing things up if 2 players try to go through at the same time.

Ie. Players without the ticket gets tp'd back a block with a "Hey, you need a ticket!" sort of message.

Players with a ticket get a "Use your ticket? [Yes]" sort of message, which triggers a /trigger command on onclick

Or is there maybe a way to:

/scoreboard players set @a[carrying "ticket" in their inventory] promptRedeemTicket 1

or something like that?

marked as duplicate by MrLemon, kalina, Mathias711, Jonathan Drapeau, Unionhawk Nov 30 '15 at 15:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.