I am trying to make it so that if an entity tries to move but a player is looking at it then it will not be able to move, but it isn't working for some reason, can someone help me?
on rightclick on zombie:
if tool is heart of the sea named "&e&lMob Transformer: &5Zombie → SCP-173":
set clicked entity's helmet to skull of "scp173" parsed as offline player named "scp173"
make clicked entity invulnerable
set clicked entity's name to "&6SCP-173"
send "%{@prefix}% &aTransformed &6Zombie &ainto &6SCP-173&a!" to player
set clicked entity's attack damage attribute to 1000
silence clicked entity
on entity walk:
if entity's helmet is skull of "scp173" parsed as offline player named "scp173":
if entity's target is set:
if player's target is not entity:
teleport entity to entity's target
kill the entity's target
else:
cancel event
else:
if player's target is not entity:
apply swiftness 3 without particles to entity
play sound "block.deepslate_tiles.place" at volume 0.5 at entity
wait 3000 ticks
else:
cancel event
if you can help me thanks