It took me awhile as a guitarist to figure this out: If you want to play a melody look inside the chords.
I know, this sounds like a Yoda riddle, but here’s the thing: There are thousands of chords. There are only 12 notes to the scale. Every one of those notes belongs to a chord. This means that as you are playing the chords to a song, you more than likely are playing the notes contained in the melody. It is, of course, possible, that a note here and there is not part of that chord. That’s what makes it interesting.
But it means that you’re likely not more than a note or two away from a root, third, fifth, sixth, ninth, etc. of the chords that you’re playing. So as you play the chords, listen for the notes in the melody, and then work from there.
What’s more, if you learn and know your inversions for all those chords, it’s even more likely you will have the note for the melody you’re looking for as you progress through the song.
This is how you get to play the chords AND the melody simultaneously.
Here’s an example with the classic song from Burt Bacharach and Hal David: “I’ll Never Fall in Love Again.”