#player.teleportTo - Bring ridden horse along
3 messages · Page 1 of 1 (latest)
you should always search in the support channel to see if you find what you need, this it what you need
vehicle is boolean value, it doesn't return the entity i think, this worked for me
if(player.respawnPosition) {
const {SpawnDimension} = player.nbt || 'minecraft:overworld';
const {x, y, z} = player.respawnPosition;
if(player.vehicle){
player.getVehicle().teleportTo(SpawnDimension, x, y, z, player.yaw, player.pitch)
}
player.teleportTo(SpawnDimension, x, y, z, player.yaw, player.pitch);
player.vehicle && player.startRiding(player.getVehicle())
}
else {
const {x, y, z} = level.getSharedSpawnPos();
if(player.vehicle){
player.getVehicle().teleportTo('minecraft:overworld', x, y, z, player.yaw, player.pitch)
}
player.teleportTo( 'minecraft:overworld', x, y, z, player.yaw, player.pitch);
player.vehicle && player.startRiding(player.getVehicle())
}```