You just gotta keep working on your ear, try to play along with simple melodies, learn to read music, get a teacher, do whatever it takes. If you know all major the scales, and what notes belong in them, that will help you find the key. What I used to do was play a cadence, and whatever note I finish on, thats what key I'm playing in. I also would think about the shout walk up, I know that if I start on C then I'm playing in Ab, If i start on the Bb then I'm in F#. does that make sense?