So I'm trying to make a pig teleport to me whenever I get more than 15 blocks away and I've done the commands for that and it works,
/execute at @e[type=pig,name=RainbowPig] run execute if entity @a[name=InceyBoi,distance=15..1000000] run tp @e[type=pig,name=RainbowPig] @a[name=InceyBoi,limit=1]
but then I want that to only happen when it isn't on a leash, so I tried:
/execute at @e[type=pig,name=RainbowPig],nbt={Leashed:0b}] run execute if entity @a[name=InceyBoi,distance=15..1000000] run tp @e[type=pig,name=RainbowPig] @a[name=InceyBoi,limit=1]
But it stopped working. Does anyone know how I can fix this?
Thanks!
/execute at @e[type=pig,name=RainbowPig] run execute if entity @a[name=InceyBoi,distance=15..1000000] run tp @e[type=pig,name=RainbowPig] @a[name=InceyBoi,limit=1]
but then I want that to only happen when it isn't on a leash, so I tried:
/execute at @e[type=pig,name=RainbowPig],nbt={Leashed:0b}] run execute if entity @a[name=InceyBoi,distance=15..1000000] run tp @e[type=pig,name=RainbowPig] @a[name=InceyBoi,limit=1]
But it stopped working. Does anyone know how I can fix this?
Thanks!
2
/execute as @e[type=pig,name=RainbowPig],nbt={Leashed:0b}] at @s if entity @a[name=InceyBoi,distance=15..1000000] run tp @s @a[name=InceyBoi,limit=1]
try this command format, its a bit more cleaned up and your formatting might be the issue
try this command format, its a bit more cleaned up and your formatting might be the issue
Thankyou this worked a lot better!
