scoreboard players set min times_appeared 0

execute if score #tesla_coil_hat shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = tesla_coil_hat times_appeared
execute if score #tesla_coil_hat shop matches 1 if score tesla_coil_hat times_appeared < min times_appeared run scoreboard players operation min times_appeared = tesla_coil_hat times_appeared

execute if score #scaled_helmet shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = scaled_helmet times_appeared
execute if score #scaled_helmet shop matches 1 if score scaled_helmet times_appeared < min times_appeared run scoreboard players operation min times_appeared = scaled_helmet times_appeared

execute if score #heavy_chestplate shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = heavy_chestplate times_appeared
execute if score #heavy_chestplate shop matches 1 if score heavy_chestplate times_appeared < min times_appeared run scoreboard players operation min times_appeared = heavy_chestplate times_appeared

execute if score #ice_chestplate shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = ice_chestplate times_appeared
execute if score #ice_chestplate shop matches 1 if score ice_chestplate times_appeared < min times_appeared run scoreboard players operation min times_appeared = ice_chestplate times_appeared

execute if score #life_leggings shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = life_leggings times_appeared
execute if score #life_leggings shop matches 1 if score life_leggings times_appeared < min times_appeared run scoreboard players operation min times_appeared = life_leggings times_appeared

execute if score #frozen_boots shop matches 1 if score min times_appeared matches -1 run scoreboard players operation min times_appeared = frozen_boots times_appeared
execute if score #frozen_boots shop matches 1 if score frozen_boots times_appeared < min times_appeared run scoreboard players operation min times_appeared = frozen_boots times_appeared
execute if score min times_appeared matches -1 run scoreboard players set min times_appeared 0