/testfor at least 10 specific items in the Inventory

This is the command I entered in the command block:testfor @p {Inventory:[{id:minecraft:diamond,Count:10}]}
But it doesn't seem to work. What am I doing wrong?
Best Answer
I have solved the problem of the not stacked testfor amount thing, (only 1.12 i guess)
as mebreadly said you can to use the clear command
to do it:
make a tower of commandblocks
the height is the amount of items you need to "testfor"
for example: i need to testfor 3 diamonds so i need 4 commandblocks
so 1 more than the amount
the first commandblock is a repeating needsredstone commandblock pointing to the air
the second (and more) are chain alwaysactive commandblocks also pointing to the air
the highest commandblock is the output
for example how it should be done:
i testfor 3 diamonds and if it tested it say hi
first cmb: /clear @p minecraft:diamond 0 1
second cmb: /clear @p minecraft:diamond 0 1
third cmb: /clear @p minecraft:diamond 0 1
fourth cmb: /say hi
some problems could be:
if you have more it also gives the output
the items are gonna be cleared so you dont have them anymore
i hope you can do something with this
have more questions? leave a comment
btw srry for spelling mistakes
(i also needed this for a captain toad minecraft map)
Pictures about "/testfor at least 10 specific items in the Inventory"



How do you test inventory items?
You can test for a certain target in the game using the /testfor command in Minecraft. TIP: Starting in Minecraft Java Edition (PC/Mac) 1.13, the /testfor command was removed from the Java Edition version of the game. Let's explore how to use this cheat (game command).Minecraft 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: Yan Krukov, Yan Krukov, Yan Krukov, Yan Krukov