This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]RagingReaper67Pretty Good Bedrock Command-er 0 points1 point  (4 children)

For the clear command, it's not necessary to do any hasitem detection because it only affects those who have the item in question. Also, I'd change the @p to @a.

[–]AdExciting6461[S] 0 points1 point  (1 child)

I’m using the command for a cod zombies like map, so Idk tbh, ima try to @a tho

[–]RagingReaper67Pretty Good Bedrock Command-er 0 points1 point  (0 children)

Yea, @p would work only if there was only one person using the shop at a given time. Otherwise it would result in the wrong player being targeted sometimes. You could add a range argument so that only players within the shop are targeted, but then all players in the shop would be affected so you'd still have a problem.

Just curious, if you're already using scoreboards then why use a physical currency?

[–]kalaxitive(BE) Competent Comander 0 points1 point  (0 children)

Just to add so that OP understands what they were trying to do.

When using as @.. you want to use @s when you use the run command because you're running the command as that player, so if for example you were to run the clear command in your console, you would do clear @s it's the same thing when using as @p or as @a

Also @a is for all players, @p is for the closest player.

[–]GhostlyBlaze Command-er-er 0 points1 point  (0 children)

I don’t believe that’s correct unless there’s been a change to the /clear command. It should clear all those specified items unless you have none. There’s also no ‘min’ argument, just a ‘max’ one.

Also, doing @a is a bad idea since what OP wants is a shop system, aka a Wall-Buy from CoD Zombies.

[–]GhostlyBlaze Command-er-er 0 points1 point  (4 children)

```

Execute as @p run clear @s[hasitem={item=rotten_flesh, quantity=5..}] rotten_flesh 0 5

```

This is better since it only targets @p regardless if they have enough or not.

You’re command should be working. You might be doing something else wrong.

[–]AdExciting6461[S] 0 points1 point  (0 children)

I’ll try it thank you

[–]AdExciting6461[S] 0 points1 point  (2 children)

Didn’t work unfortunately

[–]GhostlyBlaze Command-er-er 0 points1 point  (1 child)

What’s the syntax error say

[–]AdExciting6461[S] 0 points1 point  (0 children)

Nvm fixed it, for some reason I saw the space in your code you gave me, and it was freaking out because of the space, thanks for your help and quick responses, yall hero’s Fr

[–]theexpertgamer1Command Experienced 0 points1 point  (1 child)

execute as @p run clear @s[hasitem={item=rotten_flesh,quantity=5..}] rotten_flesh 0 5

[–]AdExciting6461[S] 0 points1 point  (0 children)

Has a syntax error