execute if score @s melee_enchant_lvl matches 2.. run return run tellraw @s {"text":"You already purchased all melee enchants!","color":"aqua"}

$execute if score @s melee_enchant_lvl matches 0 unless score @s gems matches $(enchant_melee0).. run return run tellraw @s {"text":"You don't have enough gems! ($(enchant_melee0)g)","color":"red"}
$execute if score @s melee_enchant_lvl matches 1 unless score @s gems matches $(enchant_melee1).. run return run tellraw @s {"text":"You don't have enough gems! ($(enchant_melee1)g)","color":"red"}

$execute if score @s melee_enchant_lvl matches 0 run function pctf:logic/player/gems/remove {amount: "$(enchant_melee0)"}
$execute if score @s melee_enchant_lvl matches 1 run function pctf:logic/player/gems/remove {amount: "$(enchant_melee1)"}

clear @s #pctf:melees

scoreboard players add @s melee_enchant_lvl 1

function pctf:logic/player/weapons/melee