Help me out with right and left click detection.

tick is just execute as @a at @s if items entity @s weapon.* minecraft:acacia_planks run function orb:playerloop

and playerloop is


summon minecraft:interaction ~ ~1.25 ~ {width:0.59,height:0.54,response:1}




execute as @e[type=minecraft:interaction,nbt={attack:{}},limit=1,sort=nearest] at @s run say LEFT CLICK
execute as @e[type=minecraft:interaction,nbt={attack:{}}] run data remove entity @s attack


execute as @e[type=minecraft:interaction,nbt={interaction:{}},limit=1,sort=nearest] at @s run say RIGHT CLICK
execute as @e[type=minecraft:interaction,nbt={interaction:{}}] run data remove entity @s interaction

When testing with command blocks, it worked great, but converting to a datapack has messed it up. Any ideas on how to fix this?

Continue to help post