execute if items entity @s container.* *[custom_data~{samsung_tablet:true}] if score #max_phones value > #samsung_phones_for_sale value if score #one_ui_version value matches 3.. run playsound entity.player.levelup ui @s ~ ~ ~
execute if items entity @s container.* *[custom_data~{samsung_tablet:true}] if score #max_phones value > #samsung_phones_for_sale value if score #one_ui_version value matches 3.. run tellraw @s {text:"You sold a Samsung Tablet!",color:green}
execute if items entity @s container.* *[custom_data~{samsung_tablet:true}] if score #max_phones value > #samsung_phones_for_sale value if score #one_ui_version value matches 3.. run advancement grant @s only samsung:sell_tablet
execute if items entity @s container.* *[custom_data~{samsung_tablet:true}] unless score #max_phones value > #samsung_phones_for_sale value if score #one_ui_version value matches 3.. run tellraw @s {text:"Error! Your slots are full!",color:red}
execute if items entity @s container.* *[custom_data~{samsung_tablet:true}] if score #max_phones value > #samsung_phones_for_sale value unless score #one_ui_version value matches 3.. run tellraw @s {text:"Error! You need to have at least One UI 3 to sell a Samsung Tablet!",color:red}
execute if items entity @s container.* *[custom_data~{samsung_tablet:true}] if score #max_phones value > #samsung_phones_for_sale value if score #one_ui_version value matches 3.. run scoreboard players add #samsung_phones_for_sale value 3
execute if items entity @s container.* *[custom_data~{samsung_tablet:true}] unless score #max_phones value > #samsung_phones_for_sale value if score #one_ui_version value matches 3.. run scoreboard players operation #samsung_phones_for_sale value = #max_phones value
execute if items entity @s container.* *[custom_data~{samsung_tablet:true}] if score #max_phones value > #samsung_phones_for_sale value if score #one_ui_version value matches 3.. run clear @s *[custom_data={samsung_tablet:true}] 1