[1.21.5] Detect custom item

I Have 3 custom functions - Invoker, Item checker, and effect giver.

Invoker Function is as follows:

execute as @e[tag=racer] at @s run function horse_run:boostpad
execute as @e[tag=racer] at @s run function horse_run:offroad
execute as @e[tag=racer] at @s run function horse_run:jumppad
execute as @a run function horse_run:itemcheck
execute as @e[tag=racer] at @s run function horse_run:applepower```
**Item checker function is as follows:**
```execute as @a[scores={usedItem=1..}] if data entity @s SelectedItem.tag.custom_data.apple run scoreboard players set @s usedApplePower 1
#
execute as @a[scores={usedItem=1..}] run clear @p carrot_on_a_stick 1
execute as @a[scores={usedItem=1..}] run scoreboard players set @s usedItem 0```
**PowerUp function is as follows**
```execute if entity @p[scores={usedApplePower=1..}] run scoreboard players set @s applePowerStatus 82
execute if entity @p[scores={usedApplePower=1..}] run scoreboard players set @p usedApplePower 0
execute if entity @s[scores={applePowerStatus=1..}] run scoreboard players remove @s applePowerStatus 1

# Effects
execute if score @s applePowerStatus matches 1.. run effect give @s minecraft:speed 1 4 true
execute if score @s applePowerStatus matches 80 run playsound minecraft:entity.firework_rocket.launch master @a ~ ~ ~ 1 1.25 1
execute if score @s applePowerStatus matches 1.. run particle minecraft:soul ~ ~ ~ 0 0 0 0.2 2 force
execute if score @s applePowerStatus matches 1.. run particle minecraft:soul_fire_flame ~ ~ ~ 0 0 0 0.1 5 force
execute if score @s applePowerStatus matches 60 run playsound minecraft:entity.firework_rocket.launch master @a ~ ~ ~ 1 1.25 1
execute if score @s applePowerStatus matches 40 run playsound minecraft:entity.firework_rocket.launch master @a ~ ~ ~ 1 1.25 1
execute if score @s applePowerStatus matches 20 run playsound minecraft:entity.firework_rocket.launch master @a ~ ~ ~ 1 1.25 1
Continue to help post