#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#
#    This function has been created by Skilendarz Group.
#             https://skilendarz.com
#
#      GIVE MAP MAKERS THE CREDIT THEY DESERVE!
#             COPYING IS PROHIBITED!
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

scoreboard players operation @s wineffect_preview = @s buy
execute if score @s buy matches 0 run scoreboard players set @s wineffect_select 0
execute if score @s[advancements={f:victory_royal=true}] buy matches 1 run scoreboard players operation @s wineffect_select = @s buy
execute if score @s[advancements={f:halloween_tragedy=true}] buy matches 2 run scoreboard players operation @s wineffect_select = @s buy
execute if score @s[advancements={f:plot_armor=true}] buy matches 3 run scoreboard players operation @s wineffect_select = @s buy
execute if score @s[advancements={f:lightspeed_traveler=true}] buy matches 4 run scoreboard players operation @s wineffect_select = @s buy
execute if score @s[advancements={f:sniper=true}] buy matches 5 run scoreboard players operation @s wineffect_select = @s buy
execute if score @s[advancements={f:veteran=true}] buy matches 6 run scoreboard players operation @s wineffect_select = @s buy
execute if score @s[advancements={f:professional_robbery=true}] buy matches 7 run scoreboard players operation @s wineffect_select = @s buy
execute if score @s[advancements={f:warrior=true}] buy matches 8 run scoreboard players operation @s wineffect_select = @s buy

execute if score @s wineffect_select = @s buy at @s run playsound minecraft:entity.experience_orb.pickup master @s
execute unless score @s wineffect_select = @s buy at @s run playsound minecraft:ui.button.click master @s
