Need help with custom NBT tags (1.13)

I'm trying to make a specific item (carrot on a stick), so that it teleports you 10 blocks in the direction facing.

Kinda new to 1.13 so not sure what I'm doing wrong.

I'm using a scoreboard "tp" to detect a carrot on a stick being used

I gave myself a carrot on a stick with a tag "Tp"

give @s carrot_on_a_stick{Tp:1b} 1

Then in a repeating command block:

execute as @a[scores={tp=1..},nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick"},Tp:1b}] at @s run teleport @s ^ ^ ^10

However when I try to use the item it does nothing.

I tried it without the tags and it worked, however I only want a specific item to trigger this.


Try using this command instead:

/execute as @a[scores={tp=1..},nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick",tag:{Tp:1b}}}] at @s run teleport @s ^ ^ ^10

I only changed this Tp:1b to this tag:{Tp:1b}, because that is where the Tp:1b ends up, after you define it.