0

I'm trying to make a shop in Minecraft and I have the scoreboard and sell commands down but I cant get my buy option to work.

I tried using /testfor @p[score_Coin_min=2] to activate the blocks behind the first command block but I keep getting a syntax error unexpected "score".

I've tried using different variations but I can't seem to figure it out. I can just forget about that one command but it lets people buy whatever they want which results in a negative score.

1

The correct syntax for score selectors is /testfor (player)[scores={objective=number}]. However that command only selects one number. To select a minimum number you need to use a scoreboard test.

Try:

/scoreboard players test @p Coin 2
| improve this answer | |
  • You can select a range of numbers in target selectors, for example, 0..10 selects players with a score between 0 and 10 inclusive. When using fake players, however, the second option is better. – ExpertCoder14 Jul 2 at 1:37
1

To use selectors for scores, just use /testfor @p[scores={SCOREBOARDOBJECTIVEHERE = AMMOUNT}]

in your case, it may be:

/testfor @p[scores={Coin=..2}]

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.