positive metal ions attracted to the negative electrode where they gain electrons. negative non metal ions are attaracted to the positive electrode where they loose electrons.
the metal which gives its away its electrons, has to be higher in the electrochemical series than the other substance so it can make an electric current.
again the further apart the metal and other substance are, the higher the voltage.