The reason taking calcium and magnesium supplements work cricket is because deficiencies of these cause increase in the excitability of both the nerve endings and the muscles they stimulate. Potassium deficiency can also be seen to do this but more often associated with muscle weakness.