How can I detach a metal ball from a magnet using opposite force with current?
You need an electromagnet in place of one of your magnets. By passing current through a coil of wire you create a magnetic field. If the electromagnet's field is stronger than that of the permanent magnet then the ball will move. Be sure to use a material for the electromagnet's core that does not become permanently magnetized.