execute store result score #gems temp run scoreboard players get @s gems
scoreboard players set #divide temp 4

scoreboard players operation #gems temp /= #divide temp

execute if score #gems temp matches 0 if score @s gems matches 1.. run scoreboard players set #gems temp 1

scoreboard players operation @s gems -= #gems temp

execute if score #gems temp matches 1 run tellraw @s ["",{"text":"You lost ","color":"gray"},{"score":{"name":"#gems","objective":"temp"},"bold":true,"color":"green"},{"text":" Gem","color":"green"},{"text":"!","color":"gray"}]
execute if score #gems temp matches 2.. run tellraw @s ["",{"text":"You lost ","color":"gray"},{"score":{"name":"#gems","objective":"temp"},"bold":true,"color":"green"},{"text":" Gems","color":"green"},{"text":"!","color":"gray"}]

execute store result storage pctf:gems input.amount int 1 run scoreboard players add #gems temp 6

execute on attacker run return run function pctf:logic/player/gems/set_gems_to_add with storage pctf:gems input
execute as @a[tag=attacker,sort=nearest,limit=1] run return run function pctf:logic/player/gems/set_gems_to_add with storage pctf:gems input
execute as @a[tag=bow_attacker,sort=nearest,limit=1] run return run function pctf:logic/player/gems/set_gems_to_add with storage pctf:gems input