I need help to turn a function system into a script
scoreboard objectives add ptw_equiped dummy has_item
scoreboard objectives add ptw_atk_cd dummy attack_cooldown
#∆ Detector
scoreboard players set @a ptw_equiped 1
execute as @a as @s [hasitem={item=ptw:wooden_axe,location=slot.weapon.mainhand,quantity=0}] as @s [hasitem={item=ptw:stone_axe,location=slot.weapon.mainhand,quantity=0}] run scoreboard players set @s ptw_equiped 0
#∆ Indicator
# Ready
title @a [scores={ptw_equiped=1,ptw_atk_cd=..0}] title §f
# Wait
title @a [scores={ptw_equiped=1,ptw_atk_cd=1..}] title §e
# Hide
title @a [scores={ptw_equiped=0,ptw_atk_cd=..0}] title §l
scoreboard players set @a [scores={ptw_equiped=0}] ptw_equiped -1
#∆ Attack Cd
scoreboard players add @a [scores={ptw_equiped=1}] ptw_atk_cd 0
effect @e [scores={ptw_atk_cd=1..}] weakness 1 3 true
effect @e [scores={ptw_atk_cd=0}] weakness 0 3 true
effect @e [scores={ptw_atk_cd=1..}] mining_fatigue 1 4 true
scoreboard players remove @e [scores={ptw_atk_cd=0..}] ptw_atk_cd 1
It's a simple attack cooldown system.