Checking a player's inventory slot and applying a potion effect when a special tag is there.

Version: 1.21.5, Vanilla.

I created a Datapack a while back for an older version of the game, but one of the new updates absolutely obliterated it and made the entire thing unfunctional, so I'm trying to redo it at the moment. One of the biggest features of the datapack were special items you held in the upper left slot of your inventory. I then have a command in tick.mcfunction that constantly checked that inventory slot, and if an item with the speed_relic:1b tag on it was placed there, it would then give players the speed 1 effect until that item was no longer equipped.

Here is the old command that is present in tick.mcfunction, but it is no longer working: effect give @a[nbt={Inventory:[{Slot:9b,id:"minecraft:sugar",tag:{speed_relic:1b}}]}] minecraft:speed 3 0 true

How would this command have been changed since 1.20? What would the new command be?

Continue to help post