trying to detect right-click
I am trying to use a carrot on a stick to run a cmd upon right clicking it however the cmd only runs if I use the function cmd while holding the carrot on a stick. Here is the code I wrote for it
#making the scoreboard scoreboard objectives add teleporter minecraft.used:minecraft.carrot_on_a_stick #detecting the teleporter execute as @a[scores={teleporter=1..},nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick",tag:{teleporter:1b}}}] at @s run say hi #reset objective scoreboard players remove @a[scores={teleporter=1..}] teleporter 1