Study the current melodies of successful songs and artists that you enjoy.
Do you mean melodies as in singing/rapping? If so, study other people that have melodies u like. When doing that u start to hear by ear what sounds right and wrong. This isn't super melodic but a but: