I have a an area with lots of armour stands. Under each one is a dispenser with 1 - 54 items in the first slot, which is its sort of 'id'. I need to temporarily save the number of items in each of those dispensers to a scoreboard which I am doing like so:

execute as @e[tag=char] at @e[tag=char] store result score @s temp run data get block ~ ~-1 ~ Items[0].Count

however, no matter the number of items inside or anything, it will always store a 0. enter image description here I run one similar command before which is:

execute as @e[tag=getblock] at @e[tag=getblock] unless block ~ ~-1 ~ minecraft:air store result score blockCount load run data get block ~ ~-1 ~ Items[0].Count

and this runs perfectly. There is only one amour stand with that tag but that shouldn't matter because I am running the other command using @s which will just use the UUID of the entity.

What could be the reason for this?

1 Answer 1


If there is more than one armour stand, your at argument should be @s instead of @e[tag=char].

It's a complicated explanation why.

Place down two armour stands in your test world, name them One and Two respectively, and tag them test. Let's run a few commands on them (paste them into your chat):

/execute as @e[tag=test] run say Hello, World!


[Armour Stand] Hello, World!
[Armour Stand] Hello, World!

Now let's try using at instead of as:

/execute at @e[tag=test] run say Hello, World!


[ExpertCoder14] Hello, World!
[ExpertCoder14] Hello, World!

It looks like the command is executed twice, by your player, once at each position.à

Now let's combine them. Try the following:

/execute as @e[tag=test] at @e[tag=test] run say Hello, World!

... and you get 4 messages, 2 from each armour stand.

What is happening with your old command is that each armour stand is executing the /data get with each armour stand, not with itself. So armour stand 1 will execute /data get with all the other armour stands, not just itself.

Fixed command:

execute as @e[tag=char] at @s store result score @s temp run data get block ~ ~-1 ~ Items[0].Count
  • Right - that makes total sense! I assumed it would work because the other commands worked, but they only have 1 amour stand with that tag. I guess, unless you wanted that behaviour, it's a good idea to use at @s to avoid this. Sep 21, 2020 at 15:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .