The object you paint needs to be electrically conductive, which in most practical situations means it needs to be metallic.
Electrostatic painting works by charging up each tiny droplet of paint, and then setting up a E field so that the electrostatic force on the charged particles pushes them towards the object you want to paint. Car companies have used this process for a long time now. It not only saves on paint and reduces particulates in the air, but does a better job of coating the surface evenly with the paint.
It can even somewhat paint the back sides of small objects. The sprayer only needs to be roughly aimed, and each particle will find its way to the charged target surface. However, they are small particles, so the air appears quite thick to them. Some get pushed around to the back side by the air flow, with the electrostatic force then eventually pulling them towards the object.
The paint is generally not conductive. This means that opposite charge builds up on the surface of the object as the paint builds up. This attracts less new paint particles, thereby automatically evening out the paint thickness somewhat.
However, all this works by keeping the underlying object at a significantly different potential than the paint gun nozzle (and thereby the paint particles). The object needs to be conductive to do this. First, it needs to be conductive to establish the potential all along its surface in the first place. Second it needs to be conductive to counter act at least the initial opposite charge of the first layer of droplets which touch the conductive material directly. The charged paint droplets moving from the nozzle to the object is essentially a electrical current. If you can't drain that current from the object, then even a little paint will rapidly charge it up to the reverse polarity.