TransWikia.com

Teleporting entity through command block teleports entity to command block and stops moving, even with execute as

Arqade Asked on September 26, 2021

I am using a repeating command block to repeatedly teleport a falling block with a custom tag called "Debris" 0.125 blocks on the negative z axis causes the falling block to teleport to the command block instead and not moving at all:

tp @e[type=falling_block,distance=..200,tag=Debris]

I decided to fix this by forcing the falling block to run the command itself, instead

execute as @e[type=minecraft:falling_block,distance=..200,tag=Debris] run tp @s ~ ~ ~-.125

and I still got the same result of the block being frozen to the command block instead. I’m not sure what I’m doing wrong here, I summoned a block with a custom tag called "Debris", then used a repeating command block to force the block to run the command itself, but it ends up acting like the repeating command block is running the teleport command instead of the block, which is supposed to be running the command because of the execute as.

One Answer

/execute as does not change position, it changes the entity only. In your case, /execute as @e[type=falling_block], the falling block is the executor, but the position hasn't changed.

You need to add at @s in order to move the position to the executing entity. Like this:

execute as @e[...] at @s run ..

Answered by ExpertCoder14 on September 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP