^ doesn't update in repeating command block

I am trying to fly in minecraft. However, the command block isn't updating my rotation. Could someone help me? I'm using this command in a repeating command block:

/tp @s ^ ^ ^0.5

Solution 1:

Your command, /tp @s ^ ^ ^0.5 is being run in a command block. @s always refers to the executor, that is, the "thing" running the command.

Since your command is running in a command block, the "thing" running the command is the server. So, @s would not refer to you.


You can use /execute to change who the command is being executed as, like so:

execute as @p run tp @s ^ ^ ^0.5

This makes the nearest player run the command. If you try this, you will find that it works- sort of.


What does tp @s ^ ^ ^0.5 do, exactly? It teleports the target 0.5 blocks forward. However, the command is being executed at the command block, so you will be teleported 0.5 blocks in front of it. To combat this, we need to change where the command is being executed, like so:

execute as @p at @s run tp @s ^ ^ ^0.5

Now you can "fly" in Minecraft.