I was testing out this really fun command:

```
/execute at @e[type=arrow] run summon lightning_bolt.

```

It was really fun, summoning an entire line of lightning bolts, one after another, but what if I would only like to have the lightning strike after the arrow has hit something (like a block, not a mob), and I would only want lightning to strike an x amount of times.

There is this code that looks appealing, but I don't know how to use it.

```
/testfor @e[type=Arrow] {inGround:1b,player:1b}

```

Is there a way to do this? For example, I were to shoot an arrow, and lightning were to NOT be summoned yet, and when the arrow hits a block/player, I would want it to summon lightning 5 times, and make the arrow disappear, how would I write it in a command block/chain of command blocks?

Also, preferably, I would like to have **only** the arrows shot from a bow named (let's say it's named "text"), to be affected by this command. So that's another problem I have to deal with.

What I would also need it the arrangement of the command blocks, like which is facing which, and such and such.

The closest article I can find about this is this: [How do I make a Lightning Bow in vanilla Minecraft?](https://gaming.stackexchange.com/questions/232894/how-do-i-make-a-lightning-bow-in-vanilla-minecraft?rq=1). But here's the thing, the answer just lists out a bunch of commands, doesn't really say the configuration of the command blocks.

Thanks for helping me, (if you did)!

(1.17.1 or 1.16.5)