Q:

Lightning Bow Affecting Only Certain People

I know the command:
/execute @e[type=Arrow,c=1] ~ ~ ~ summon LightningBolt

But I want to know how to make this command only affect certain people. I have a scoreboard objective set up called "bowupgrades" and I want the lightning bow command to only affect those who have "bowupgrades" with a score of 1 (default is 0). How do I do this?

A:

Setup:
Create an objective to keep track of when players fire an arrow:
/scoreboard objectives add firedArrow stat.useItem.minecraft.bow

Repeating commands:
Have the following commands constantly repeating, in this order:
/execute @a[score_bowupgrades_min=1,score_firedArrow_min=1] ~ ~ ~ /scoreboard players tag @e[type=Arrow,c=1,r=3] add Lightning
/scoreboard players set @a[score_firedArrow_min=1] firedArrow 0
/execute @e[type=Arrow,tag=Lightning] ~ ~ ~ /summon LightningBolt

This makes it so when a player with bowupgrades >= 1 fires an arrow, they put a "Lightning" tag (1.9+, use objectives for 1.8 or lower) on the arrow, which then makes the arrow constantly summon lightning.

1.8 compatible
Create an additional objective to keep track of arrows that are lightning, rather than using a tag:
/scoreboard objectives add isLightning dummy

This version will also need the objective to delay the lightning bolts, as requested in the comments:
/scoreboard objectives add lightningTimer dummy

Update your repeating commands to the following:
/execute @a[score_bowupgrades_min=1,score_firedArrow_min=1] ~ ~ ~ /scoreboard players set @e[type=Arrow,c=1,r=3] isLightning 1
/scoreboard players set @a[score_firedArrow_min=1] firedArrow 0
/execute @e[type=Arrow,score_isLightning_min=1,score_lightningTimer_min=20] ~ ~ ~ /summon LightningBolt
/scoreboard players add @e[type=Arrow,score_isLightning_min=1] lightningTimer 1

