First, you need to choose what the key of the song is. For example, if your chords all revolve around an ''A Major chord,'' then you are most likely in that key.
So once you have decided what the key is..you can make melodies or riffs that are in the same key as that key. These could be whatever scales are associated with that key..for example: In the key of ''A Major'' you could play these scales to make your melodies or solos-A Major Scale, A Major Pentatonic Scale, E Mixolydian Scale, etc. etc.
The melodies and scales you have in your song will be based off of the chords thatmake up the rhythm.
Writing lead and rhythm parts can be done in many different ways and methods. I would suggest writing some chord progressions and then playing scales over those progressions that are in the corresponding key. Perhaps this could get some ideas going for you. Also, you should look at the artists you like to listen to, and then try to observe how they made their music.
I would recommend checking out some books on music theory/composition in the future.
Ryan Buckner, Ysrafel