#Teleport does not work on survival work someone help to fix
1 messages · Page 1 of 1 (latest)
Use script teleport
how
Uhh, what's the entity that should have teleport tag?
I need to teleport the trident and entity that got hit by trident to the “teleport” tag
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?
how to teleport entity that got hit by trident to player too?
const t = event.getEntityHit()?.entity
can you describe everything you need from this code?
I need to teleport the trident and a hitEntity to the player with specific tag (I tried to use tp but it won’t work on survival mode)
is the player the owner of the trident?
I didn’t define that