Hi im having trouble making up melodic riffs for my songs. i can make good heavy riffs but when i get to a part when i wanna put in a melodic part it just falls apart.

so if anyone could give me some tips and formulas for my melodic riffs for metal song that would awesome! thanks