Okay so I asked a question earlier and I wasn't so clear. I'll try and rephrase it. I want to learn how to take a song, and then play something on the guitar that sounds like the vocals. For example: Wake me up when september ends by green day. I want to take the vocal melody and play it on guitar. How would I go about doing that?
By learning some scales - major and minor initially, you'll be able to recognise which notes follow in certain keys. Then you'll be able to play the notes sequentially to whatever song.
Or - do like I did for too many years - blindly search for each note as it comes along, with very little clue as to whether it's 1, 2 3 or 4 frets away from the last note played. Then, I didn't realise how important knowing sets of notes could be. Scales were something you had to do in exams. True, but that's not even a quarter of what they do.
Your best bet is probably to start to take ear training and/or sight singing classes to learn to recognize notes and intervals. Once you learn how to sing the same note that you are hearing, you can learn to sing along with the melody of the song. Once you can sing the melody of the song in-key and on-pitch, then you can find the notes on the guitar that match your singing, and then you will have it.
It would also help to take music theory courses (many universities combine music theory with sight singing and ear training) so you understand how chords and scales work together. By learning the chords and knowing music theory, you can determine the key(s) a song is in and what scale(s) it uses, and that will help you narrow down the notes for the vocal melody.
When I went through the process I've outlined above, I was able to figure out vocal melodies on guitar after about one to two years.
Edit based on your ability to read tabs
Since you can read tabs, there's a trick. Get the tabs for the song you want to learn the melody for and learn to play the song. See if you can sing along with the song while you are playing it. Then, try to find the notes on the guitar that match the singing (including guessing). Here's the trick: some, many, or even most of the notes from the vocals will be the same notes that are in the guitar tab. Obviously not at the exact same time as they appear in the guitar part, but sometimes they will be at the same time. Like you might play a chord and the note on the high E string or the B string might be the same as the note the singer is singing at that time.
If the tab has chord names in it, you might also learn the scale(s) for the most common chord(s) in the song. The notes from the vocal melody are probably mostly in that scale.
It is dependent on a song. For pop punk vocals usually base on chord roots plus some extra notes(mainly from minor scale). There is no universal rule because because many vocal compositions will sound good with certain chords. Also don't forget about choosing proper key.
You don't just "guess notes from the melody," you evaluate the notes and very quickly home in on the cluster. The more you do this, the less guesswork there is.
"Normal" rock singers generally do not have more than an octave of vocal range, and vocal melodies generally are much narrower in range and cluster on the chord starting a riff, frequently the melody is an "add-a-finger or lift-a-finger" modification of the chord.
If you can whistle it, you can find it, but if you have one of the console rock'n'roll games, try putting the mic on/in the guitar and then play as the vocalist on easy-no-fail mode.
The gist of these answers is correct: try notes from the related key/scale or from notes in and around the chords; practice singing then playing notes into your tuner to make sure you're playing the notes you think you are.
Another thing to think about is that melodies played on guitar just don't sound the same as when sung. I'm not sure if it's because most people use subtle variations that are hard to mimic on guitar or because the sound of singing is so deeply ingrained in our psychology that it's hard to created a pleasing facsimile, but my point is that translating vocal melodies can be tricky.
Most melodies are simpler than you'd think, usually bouncing back and forth among a few notes, but some times not notes that all make sense for the current chord. Sometimes the singer makes it sound like a great melodic leap that was actually a small step or even a return to the same note. As a bad singer, I don't know how they work this magic.
Finally, you are going to be wrong. You're going to work out melodies that everyone agrees sound right, but years from now you'll realize how wrong you've been. That's just part of the process; don't sweat it.
The real answer is to learn to read sheet music and understand music scales and music theory. That's a musician.
The other category of people who play guitar rely on tabs. They may know some chords and progressions but they have not really taken the time (and it takes A LOT OF TIME) to learn to read sheet music. Without tabs they are lost. This goes without saying you can still play songs purely on tab but it's the lazy man's approach and you are cheating yourself out of being a better guitar player. Most hobby players don't want to take the time and dedication it takes to read sheet music. They prefer the spoon fed approach.
I have been an on and off guitar player for over 20 years. I fell into the tab category my whole life up until about 3 weeks ago when I decided to start playing finger style classical music. I purchased a Spanish acoustic guitar and classical guitar book, it contains zero tabs. I would consider myself an infant at this point in my journey. I am learning to read just basic open strings at this point. One must learn to crawl before you can walk and eventually run. This could take you decades depending on your level of commitment. The other thing tab players get wrong very very very often (as seen on YouTube videos) is tempo. If you can't keep a tempo spot on with a metronome for every single note you need to practice that part until it's 100%. In videos I watch, people play too fast, too slow etc.
Yes it's a PITA. Up to you and which journey you proceed. I have chosen the hard route but I have no doubt it will make me a better player than just hoping to find some tabs that may or may not be accurate.