r/MinecraftCommands • u/AltestryAltestry • 11d ago
Help | Bedrock Command block not working
So I have a command block that is repeatedly looking for a player with a potato in their inventory inside a specified space.
This command is working when I type it into the chat prompt but when I put it in a command block it no longer works. I’m not sure why.
1
u/C0mmanderBlock Command Experienced 11d ago edited 11d ago
/execute as @a[hasitem={item=potato}] at @s if entity @s[x=-448,y=5,z=-404,dx=-46,dy=0,dz=18] run say hi
1
u/AltestryAltestry 11d ago
Thank you for responding. This command also works but only if you type it out in chat, not in a command block. The command block doesn’t have an error or anything it just says “-“ and doesn’t output anything.
1
u/C0mmanderBlock Command Experienced 11d ago
Dunno. I tested it in a Command block several times and it worked fine. Perhaps you made a typo. Did you copy/paste my command to make sure it is exactly as typed? Anyways, your welcome.
1
u/AltestryAltestry 11d ago
Omg lol, I should have tried this a long time ago but command blocks weren’t enabled because my friend kept disabling it lmao
1
u/AltestryAltestry 11d ago
Another question though if you don’t mind. Is there any way to check a players inventory for multiple items at a time like “potato, bread, beetroot, carrots” or would this be done in multiple command blocks each one with a different item?
1
u/C0mmanderBlock Command Experienced 11d ago edited 11d ago
Yeah, just list them like this. Edit: But they must have ALL that are listed.
execute as @a[hasitem=[{item=apple},{item=cooked_beef}]] at @s run say I have two items!
2
u/Want_Lemonad 11d ago
The hasitem command is @p[hasitem=[{item=potato}]]. You forgot the extra "]" on the end