So, thereâs no reason why they should not work on gnats. In fact, there are plenty of gnat-killing sprays and pesticides in the market from which to choose. Get one and spray it directly onto the gnats themselves or in the areas where the flies mostly inhabit.