This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
Hello there! I am working on a command block creation, and I am looking for a way to have mobs teleport to a player when they punch or left click on them. Is there any way to do this?
Yes.
You just need to check if a player hit a mob and if, which one:
/scoreboard objectives add Punched stat.damageDealt
Now just check which mob got hit:
/execute @a[score_Punched_min=1] ~ ~ ~ scoreboard players tag @e[r=4,c=1] add hitted {HurtTime:10s}
Now you can teleport the mob:
/tp @e[tag=hitted] @p /scoreboard players tag @e[tag=hitted] remove hitted /scoreboard player set @a[score_Punched_min=1] Punched 0
Hello there! I am working on a command block creation, and I am looking for a way to have mobs teleport to a player when they punch or left click on them. Is there any way to do this?
Yes.
You just need to check if a player hit a mob and if, which one:
Now just check which mob got hit:
Now you can teleport the mob: