scoreboard players set @a[scores={magMP5=30},nbt={SelectedItem:{components:{"minecraft:custom_data":{weapon:"mp5"}}}}] shiftreload 0

execute as @a[scores={shiftreload=2..},nbt=!{SelectedItem:{components:{"minecraft:custom_data":{weapon:"mp5"}}}},tag=mp5Reloading] run function ray_demo:reload/mp5/reset
execute as @a[scores={shiftreload=0},nbt={SelectedItem:{components:{"minecraft:custom_data":{weapon:"mp5"}}}},tag=mp5Reloading] run function ray_demo:reload/mp5/reset
execute as @a[scores={shiftreload=2..},nbt={SelectedItem:{components:{"minecraft:custom_data":{weapon:"mp5"}}}},tag=!mp5Reloading] run function ray_demo:reload/mp5/reset
execute as @a[scores={shiftreload=2..,mp5CD=1..},nbt={SelectedItem:{components:{"minecraft:custom_data":{weapon:"mp5"}}}}] run function ray_demo:reload/mp5/reset
execute as @a[scores={shiftreload=1..,magMP5=..30,mp5CD=..0,9mm=1..},nbt={SelectedItem:{components:{"minecraft:custom_data":{weapon:"mp5"}}}}] run tag @s add mp5Reloading