How to test for minimum amount of items in inventory and execute a command if true
I am using the AmazingKit plugin on my Minecraft server to make inventory kits for players. In a command block I have the following command:
/tellraw @p ["",{"text":"Iron","clickEvent":{"action":"run_command","value":"_____"}},{"text":" / "},{"text":"Gold","clickEvent":{"action":"run_command","value":"_____"}}]
Which prints the following result: Iron / Gold.
When a player clicks on Iron, what command should I write where the empty space is _____ in order to check if the player has at least (>=) 20 iron ingots in his inventory and if he/she does, remove 20 iron ingots and execute /kit Basic. If the player has less than 20 iron ingots in inventory, the command won't be executed. Instead, Insufficient amount of iron ingots will be printed out.
Same applies when a player clicks on "Gold".
I'm on 1.14 version
Pictures about "How to test for minimum amount of items in inventory and execute a command if true"



How do you test inventory items?
You can use the /invsee <name> command to achieve this. You can also modify a users inventory using this command.What is the command to check inventory?
How to Enter the CommandMinecraft Bedrock - Test For Items In Inventory (Mobile/Xbox/PS4/Windows 10/Switch)
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Rodolfo Clix, Pixabay, RODNAE Productions, RODNAE Productions
