#Teleport does not work on survival work someone help to fix

1 messages · Page 1 of 1 (latest)

normal wedge
#

anyone?

#

help

#

psplslslsl

sharp eagle
#

Use script teleport

normal wedge
sharp eagle
#

Uhh, what's the entity that should have teleport tag?

normal wedge
sharp eagle
#
world.afterEvents.projectileHitEntity.subscribe((event) => {
    const { projectile, hitEntity } = event;

    if (!projectile || !projectile.isValid()) return;
    if (projectile.typeId === 'minecraft:thrown_trident') {
        projectile.dimension.getPlayers({...projectile,maxDistance:5}).forEach(p => p.applyDamage(5))
        
        projectile.runCommandAsync("particle minecraft:huge_explosion_lab_misc_emitter ~ ~ ~");
        projectile.runCommandAsync("playsound random.explode @e[r=20,type=player]");
        const t = projectile.dimension.getEntities({...projectile, tags:['teleport'], closest:1})[0]
        projectile.teleport(t.location);
        projectile.runCommandAsync("playsound beacon.deactivate @e[r=20,type=player]")
        system.runTimeout(() => {
            t.removeTag('teleport')
        }, 3);
    }
});
#

is the teleport tag a trident entity as well?

normal wedge
sharp eagle
#

const t = event.getEntityHit()?.entity

normal wedge
#

I did it but it still works on creative mode not on the survival one

void thorn
normal wedge
void thorn
#

is the player the owner of the trident?

normal wedge