#why not working?
1 messages · Page 1 of 1 (latest)
if score is only able to compare one target to another target
To compare two entity’s IDs:
/execute as <target1> positioned as <target2> if score @s obj = @n obj run /…```
Optimisation Tips
U can use positioned as and at interchangeably, just positioned as is more optimised for this application
The order of as and positioned as is also swappable, but it is most optimised in this orientation
<target1> should be ur entity without the spawned tag for maximum optimisation
—
To check if an entity without a matching ID exists, ull need to undo a condition by checking if an entity with a matching ID exists
U can use tags for this:
/tag <target1> add foo
/execute as <target2> positioned as <target1> if score @s obj = @n obj run /tag @n remove foo
/kill @e[tag=foo]```
Your score must say c=1, you cannot detect more than one entity in "if score"
/execute as @e[name="§9Blue P ortal",tag=spawned,rm=2] at @s if score @e [name="§9Blue Portal",tag=!spawned,c=1] ID = @s ID run kill @s
@n is a better alternative to c=1
Just is slightly better practice bc it’s cleaner