How do I detect a certain mob?

Solution 1:

Here is a few things you can try:

Remove the / at /setblock. The / may be causing minecraft to skip over the /execute and instead automatically do /setblock.

OR

Make sure the mob is actually in range. If the mob is outside a range of 14 blocks, the command will execute, giving an unwanted output.