Why pet won't teleport to player?
Code:
on teleport:
loop all entities:
if name of loop-entity is "Haustier von %player%":
if distance between player and loop-entity is less than 15:
if distance between player and loop-entity is bigger than 3:
make loop-entity pathfind to location of player with speed 1.3
else if distance between player and loop-entity is bigger than 15:
teleport loop-entity to position of player
if world of player is not world of loop-entity:
teleport loop-entity to position of player
command /petMenu:
trigger:
open chest with 1 rows named "&6Petauswahl" to player
format slot 0 of player with wolf spawn egg named "<grey>Pet: &2Wolf" to close then run "pet %player% Wolf"
format slot 2 of player with horse spawn egg named "<grey>Pet: &2Pferd" to close then run "pet %player% Horse"
command /pet <player> [<entity type>]:
permission: sk.admin
trigger:
while health of {pet1.%arg 1%} is more than 0:
stop
spawn arg 2 at arg 1
wait 5 ticks
tame last spawned entity to arg 1
set {pet1.%arg 1%} to spawned entity
set display name of spawned entity to "Haustier von %arg 1%"