execute at @s run data modify entity @s Item.tag merge value {kyuthreearmormodule:1b}
data modify entity @s Item.tag.display.Lore append value '{"text":"+3 armor ","color":"#802E2E"}'

execute at @s run execute at @e[name=CadeyrnCrafting,sort=nearest,limit=1] run tellraw @a[distance=..4] ["",{"text":"Your chestplate now has the '+3 armor' module!","color":"gold","italic":true}]
execute at @s run kill @e[distance=..5,nbt={Item:{id:"minecraft:netherite_block",Count:1b}},tag=!SaveMe,limit=2]


#I got a bit lazy so uh....yeah. copy and paste certain parts just to make sure it works properly since the first line of the function clears tags
execute as @s run function zzzzdonotuse:modifyarmor/checkarmorstatslot
scoreboard players set @s ArmorStuff 0
execute store result score @s[tag=FoundArmorTag0] ArmorStuff run data get entity @s Item.tag.AttributeModifiers[0].Amount 100
execute store result score @s[tag=FoundArmorTag1] ArmorStuff run data get entity @s Item.tag.AttributeModifiers[1].Amount 100
execute store result score @s[tag=FoundArmorTag2] ArmorStuff run data get entity @s Item.tag.AttributeModifiers[2].Amount 100
execute store result score @s[tag=FoundArmorTag3] ArmorStuff run data get entity @s Item.tag.AttributeModifiers[3].Amount 100
execute store result score @s[tag=FoundArmorTag4] ArmorStuff run data get entity @s Item.tag.AttributeModifiers[4].Amount 100
execute store result score @s[tag=FoundArmorTag5] ArmorStuff run data get entity @s Item.tag.AttributeModifiers[5].Amount 100
execute store result score @s[tag=FoundArmorTag6] ArmorStuff run data get entity @s Item.tag.AttributeModifiers[6].Amount 100
execute store result score @s[tag=FoundArmorTag7] ArmorStuff run data get entity @s Item.tag.AttributeModifiers[7].Amount 100
execute store result score @s[tag=FoundArmorTag8] ArmorStuff run data get entity @s Item.tag.AttributeModifiers[8].Amount 100
scoreboard players add @s ArmorStuff 300
execute store result entity @s[tag=FoundArmorTag0] Item.tag.AttributeModifiers[0].Amount double 0.01 run scoreboard players get @s[tag=FoundArmorTag0,scores={ArmorStuff=1..}] ArmorStuff
execute store result entity @s[tag=FoundArmorTag1] Item.tag.AttributeModifiers[1].Amount double 0.01 run scoreboard players get @s[tag=FoundArmorTag1,scores={ArmorStuff=1..}] ArmorStuff
execute store result entity @s[tag=FoundArmorTag2] Item.tag.AttributeModifiers[2].Amount double 0.01 run scoreboard players get @s[tag=FoundArmorTag2,scores={ArmorStuff=1..}] ArmorStuff
execute store result entity @s[tag=FoundArmorTag3] Item.tag.AttributeModifiers[3].Amount double 0.01 run scoreboard players get @s[tag=FoundArmorTag3,scores={ArmorStuff=1..}] ArmorStuff
execute store result entity @s[tag=FoundArmorTag4] Item.tag.AttributeModifiers[4].Amount double 0.01 run scoreboard players get @s[tag=FoundArmorTag4,scores={ArmorStuff=1..}] ArmorStuff
execute store result entity @s[tag=FoundArmorTag5] Item.tag.AttributeModifiers[5].Amount double 0.01 run scoreboard players get @s[tag=FoundArmorTag5,scores={ArmorStuff=1..}] ArmorStuff
execute store result entity @s[tag=FoundArmorTag6] Item.tag.AttributeModifiers[6].Amount double 0.01 run scoreboard players get @s[tag=FoundArmorTag6,scores={ArmorStuff=1..}] ArmorStuff
execute store result entity @s[tag=FoundArmorTag7] Item.tag.AttributeModifiers[7].Amount double 0.01 run scoreboard players get @s[tag=FoundArmorTag7,scores={ArmorStuff=1..}] ArmorStuff
execute store result entity @s[tag=FoundArmorTag8] Item.tag.AttributeModifiers[8].Amount double 0.01 run scoreboard players get @s[tag=FoundArmorTag8,scores={ArmorStuff=1..}] ArmorStuff