Need help with a command selector
I have this command:
Continue to help post/execute as @a[sort=nearest,limit=1,nbt=!{SelectedItem:{"minecraft:custom_data":{pig: "1"}}}] run say hello
basically what I want to do is that the nearest player to where the player is looking has to say hello or basically gets selected but for the life of me cant work out why the custom data part isnt working. It works fine when i just say id: stick any ideas?