If the plates on a homemade leyden jar are away from the glass a little bit will it still work?

or does it actually have to be close to the glass
(ps i am using aluminum foil as the plates on a glass jar)