Ok, so let me explain. I have 3 scoreboards set up: use, which tests for when a player breaks an emerald block, att to move the use score over to, and targ which is set when someone is being targeted, which should be a 10 block radius that is not the executor. The problem is that targ is given to everyone in the 10 block radius, including the executor.

Here are the commands that are fine. testfor @a[score_use_min=1] which is on a clock, running into scoreboard players set @a[score_use_min=1] att 1 into scoreboard players set @a use 0 into the command block with the problem, this one:

execute @a[score_att_min=1] ~ ~ ~ scoreboard players set @e[r=10,score_att==0] targ 1. What's wrong with it? Why is every entity in the 10 block radius given the targ score of one?


/execute @a[score_att_min=1] ~ ~ ~ scoreboard players set @e[r=10,score_att= = 0] targ 1

You have a second equals sign, breaking syntax. The parameter is ignored for being invalid, thus the parameter set only contains r=10.

/execute @a[score_att_min=1] ~ ~ ~ scoreboard players set @e[r=10,score_att=0] targ 1

However, keep in mind that players & non-player entities will not have a score of 0 to detect if they are not instantiated into the scoreboard. That is, if the targets have not had a score set yet, you won't be able to target them with score_att=0 because they have no score whatsoever.

A quick fix is to add 0 when necessary, which preserves the scores of those that are already tracked but forces other targets that aren't tracked to have a default score of 0.

/scoreboard players add @a att 0

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.