Summoning lightning at snowball [duplicate]

Solution 1:

A look over at the entity IDs wiki shows that the proper entity ID for lightning is lightning_bolt.

You no longer need to use comparators out of command blocks to execute a second command block. You can now use chained execution. Face the first block at a second command block. Set the second command block to Chain Conditional. If the first command block executes successfully, the second command block will be executed.

In this case, you do not need to do that. You can skip the testfor command entirely. Only use the execute command in a repeating command block. It will not execute unless a snowball is found.

This command functions properly:

execute @e[type=snowball] ~ ~ ~ summon lightning_bolt ~ ~1 ~

Image