Guitar scales are used to write music by giving you a good idea of what notes will sound good when played together. If you're writing a solo for a song, a scale can tell you which notes will likely work really well together and can help you figure out what to play next.
What scales to learn as a guitarist?
The Minor Pentatonic Scale is the best scale to learn if you want to learn guitar scales to play solos and lead guitar.