Minecraft /testfor shop help

Minecraft /testfor shop help - Ethnic girl choosing fruit in market with mother

I need help to fix this command. I have tried but it does not work in 1.9 The command is testfor @a[r=3,score_GameTokens_min=5] > give @p cooked_porkchop 3 | /scoreboard players remove @p[r=3] GameTokens 5. When i try it says Invalid stuff and expected { as first char. If you can fix this I would greatly appriciate it. I already tried changing it a few times and I searched online but there was none so I had to make a new thread.



Best Answer

You'll likely want to use an impulse block with the following command (thanks @Skylinerw for reducing the command!):

/give @p[r=3,score_GameTokens_min=5] cooked_porkchop 3

Followed by an always active unconditional chaining command block:

/scoreboard players remove @p[score_GameTokens_min=5] GameTokens 5

You'll want to make sure that @p always targets the right player - integrating a temporary dummy objective to trace the player who's buying might be beneficial here, if you need help with that, ask another question on the main site.




Pictures about "Minecraft /testfor shop help"

Minecraft /testfor shop help - Anonymous man giving money to poor beggar on tiled sidewalk near shop showcases in town at dusk
Minecraft /testfor shop help - Emergency Signage
Minecraft /testfor shop help - The Big Support Lettering Text on Black Background



How do you use Testfor in Minecraft?

How to Enter the Command
  • Test if Players are within 10 blocks. In this example, we will test to see if there are any players within a 10 block radius with the following command: /testfor @a[r=10] ...
  • Test if Mooshrooms are within 50 blocks. ...
  • Test if Nearest Player is at Level 20 experience.


  • What replaced the Testfor command in Minecraft?

    The /testfor command became obsolete in Minecraft 1.13, and has been replaced by the /execute command*. It will do the same as typing /testfor @e {SelectedItem:{id:"<item>"}} and then putting a comparator to the command block with the command, and then running the command which you wanna run.



    Minecraft Redstone Tutorial | How to use testfor commands in MCPE!




    More answers regarding minecraft /testfor shop help

    Answer 2

    Try using a comparator.

    First command block:

    /testfor @a[r=3,score_GameTokens_min=5]
    

    Then use a comparator followed by a repeater going to 2 command blocks:

    /give @p cooked_porkchop 5
    
    /scoreboard players remove @p GameTokens 5
    

    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Kamaji Ogino, Sinitta Leunen, Pixabay, Anna Tarazevich