tag @a remove hasElytra
tag @a[nbt={Inventory:[{id:"minecraft:elytra",Slot:102b}]}] add hasElytra

execute at @e[type=item,tag=pickup,tag=!giveFireworks] as @a[tag=!hasElytra,distance=..1] at @s run function parkour_pyramid:services/elytra/pickup
execute at @e[type=item,tag=pickup,tag=giveFireworks] as @a[tag=!hasElytra,distance=..1] at @s run function parkour_pyramid:services/elytra/pickup_fireworks
tag @a[tag=gaveElytra,scores={death=1..}] remove hasElytra
function parkour_pyramid:services/elytra/clearareas
function parkour_pyramid:services/elytra/fireworks

replaceitem entity @a[tag=elytraFirework] armor.chest elytra{HideFlags:55,Unbreakable:1,Enchantments:[{id:"minecraft:binding_curse",lvl:1},{id:"minecraft:vanishing_curse",lvl:1}]} 1
replaceitem entity @a[tag=elytraFirework] hotbar.4 minecraft:firework_rocket 1