#player.teleportTo - Bring ridden horse along

3 messages · Page 1 of 1 (latest)

gentle juniperBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

inner gulch
#

you should always search in the support channel to see if you find what you need, this it what you need

inner gulch
#

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())
    }```