I've been trying to create a command block where the player places down a spawn egg and they will be teleported in front of them. I have already figured out the spawn egg part but I can't figure out the teleport part. (Also the spawn egg is a chicken)
Your command is the following.
execute as <selector> at @s run tp ^ ^ ^5
That will teleport you 5 blocks in front of you. The
^ are used for cords relative to what your head rotation is. The first
^ is for left/right. The second is for up/down(positive being up and negative being down). The last one is for forward/backward(positive being forward and negative being backward). Remember, these are relative to what your head rotation is. Make sure to execute the to command as the entity you want to tp.