TransWikia.com

How to activate commands around a tagged entity with command blocks?

Arqade Asked by CautiousNinja 199 on April 16, 2021

So I am trying to set the score of a person within two blocks of a tagged armor stand, but the commands I thought would work don’t.

I have tried

execute at @e[tag=GFlag] run scoreboard players add  @a[scores{dropFlag1.0=0},team=Red,distance=..2] 1

and

execute at @a[team=Red,scores={dropFlag1.0=0}] if entity @e[tag=GFlag,distance=..2] run scoreboard players add @a[team=Red,scores={dropFlag1.0=0}] 1

but neither has had the results I wanted.

One Answer

Make sure you have a scoreboard set up, you can add one using this command:

/scoreboard objectives add <objective> dummy

The first command has 2 spaces before the @a[..., it misses a = after scores, and you didn't specify what objective to add 1 to.

execute at @e[tag=GFlag] run scoreboard players add @a[scores={dropFlag1.0=0},team=Red,distance=..2] <objective> 1

The second command also doesn't specify what objective to add a point to and it executes as the command block and not as any player, it only uses the players location. This is what it should look like:

execute as @a[team=Red,scores={dropFlag1.0=0}] at @s if entity @e[tag=GFlag,distance=..2] run scoreboard players add @a[team=Red,scores={dropFlag1.0=0}] <objective> 1

I'm not sure if objectives allow a . in their name, you can try to only use letters instead of dropFlag1.0. This is what it should look like:

You should also make sure that the dropflag1.0 scoreboard objective is equal to 0 when you run the command and make sure that it exists in the first place.

Answered by user232393 on April 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP