/execute working in command line but not in command block



  • I'm new to commands, so it's very likely that I'm missing something obvious. I'm trying to teleport myself from the Overworld to specific coordinates in the Nether.

    The command works in the command line, but when I try to run it in a command block, the "loading terrain" screen displays for about two minutes before loading what appears to be a void in which I can't move or break/place anything. When I quit and re-load the world, I'm in my original location in the Overworld and the command block output says:

    "An unexpected error occurred trying to execute that command."

    I'm running Java edition 1.18.1 with Forge, optifine, and WorldEdit 7.2.9. The command I'm trying to run is:

    /execute as @p in minecraft:the_nether run tp @p ~ ~ ~ 
    

    I've also tried:

    /execute as @s ...
    /execute as @e ...
    /execute as @p at @s ...
    /execute in minecraft:the_nether ...
    

    But, as I said, I really don't know what I'm doing, so I have no idea what the problem could be to begin with.

    Somebody please help!



  • These ~ are to signify the current location of a person. So if a player is below Y=0, then they teleport below the bedrock in the Nether.

    A tip with the /execute command, since you used as @p you can just simply do run tp ~ ~ ~ and it works perfectly fine.

    So the command that works in command blocks for me is:

    execute @p in minecraft:the_nether run tp ~ ~ ~
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2