Metals have high melting points because of the strong electrostatic attraction between positive metal ion s and delocalised sea of electrons. Number of delocalised electrons per atom affects melting point. More there are stronger bonding will be and higher the melting point. Mg2+ had 2 delocalised electrons per atom, so it got a higher melting point than Na+, which only has one.