How do I summon something at all entities with a certain scoreboard value?
Solution 1:
as
only changes the executor of the command (what @s
is), not the position. To set the position of the command to the snowball, use at @s
:
execute as @e[type=minecraft:snowball] at @s if score @s age > 20 numbers run summon minecraft:lightning_bolt
Also, you don't need [type=minecraft:snowball]
in if score @s[type=minecraft:snowball]
because @s
will always be a snowball (you selected only snowballs in @e[type=minecraft:snowball]
).
Solution 2:
CherryBlossom's answer is correct. I just wanted to point out another way to do it.
You can also type in the score directly in the target selector. This will save you some characters.
execute as @e[type=snowball,scores={age=20..}] at @s run summon lightning_bolt
the dots after the number 20 indicate "20 or larger".