Help with execute attribute

Trying to make it so that this only works in slots 24b and 25b and also make it only work for this emerald:

give @p minecraft:emerald{display:{Name:'{"text":"Rust Badge","color":"green","bold":true}'},rustbadge:true}

the execute attribute command that im running is:

execute as @a[nbt={Inventory:[{id:"minecraft:emerald"}]}] run attribute @s generic.max_health modifier add 2e5d67f4-1b61-4b38-abe8-87ecb8ffeb3e "Emerald Health Boost" -5 add

execute as @a[nbt=!{Inventory:[{id:"minecraft:emerald"}]}] run attribute @s generic.max_health modifier remove 2e5d67f4-1b61-4b38-abe8-87ecb8ffeb3e
Continue to help post