Using /execute to detect if player is located at entity
-
Before I say anything, I would like to say that I do not have much experience with commands.
Is there a way to use /execute to detect if a player is located at an entity? I tried
execute if entity @p at @e[type=minecraft:armor_stand,limit=1] run say Successful
, but it always returns successful. Any ideas?
-
Use target selector arguments to select only entities within a 0 block radius / 0 blocks away from the player.
[distance=0]
will select entities in the same block as the armor_stand.[distance=..5]
will select entities up to 5 blocks away from the armor_stand.(For Bedrock Edition use
r
andrm
selectors.https://minecraft.fandom.com/wiki/Target_selectors#Selecting_targets_by_distance