Tripwire hook that is named crate key and has the nbt canbeplaced on bedrock (gave it this tag so it couldnt be created by players)
I'm looking for a command that when a player opens the trap chest a command block will search the players inventory for said key and remove 1 from the players inventory if it is found.
I am on bedrock version so I dont know if I'm in the right section or if it's even possible to do. Any help would be greatly appreciated.
Its not possible to do from the inventory. You can detect thrown items or items on the ground but unfortunately not search for specific items in your inventory. Maybe try researching some addons
You can use "clear" command. For example: "clear @p iron_sword 0 0". First zero - data of item, second - count, you must put 0 here to check item in inventory, but at the same time so that it does not disappear.
So I have a special key I made:
Tripwire hook that is named crate key and has the nbt canbeplaced on bedrock (gave it this tag so it couldnt be created by players)
I'm looking for a command that when a player opens the trap chest a command block will search the players inventory for said key and remove 1 from the players inventory if it is found.
I am on bedrock version so I dont know if I'm in the right section or if it's even possible to do. Any help would be greatly appreciated.
Its not possible to do from the inventory. You can detect thrown items or items on the ground but unfortunately not search for specific items in your inventory. Maybe try researching some addons
You can use "clear" command. For example: "clear @p iron_sword 0 0". First zero - data of item, second - count, you must put 0 here to check item in inventory, but at the same time so that it does not disappear.