The difference between scales and keys
Both scales and keys refer to groups of tones and sometimes we can either say scale or key and mean the same thing. Still, there is a difference.
A key is a collection of tones and it is common to say that a piece of music is written in the key of… For example, a song that includes the chords G, C, D and Em are most likely in the key of G. That is because all the tones that belongs to the four chords also belongs to the key of G (which are G, A, B, C, D, E, F#).
It is true that the G Major Scale includes the same tones: G, A, B, C, D, E and F#. But a song in the key of G could at the same time include several scales. For example, a guitarist playing a blues song in the key of A may use both the pentatonic minor and major scales.
What also separates keys and scales is that when we refer to a key it tends to be in major or minor. But with scales, there is a large diversity. Yes, we talk about major and minor scales, but also about Melodic Minor scales, pentatonic scales, bebop scales and lots of others. A pianist may choose to use the E flat Bebop scale in a jazz tune, but we don't say about a jazz tune that it is in the key of E flat Bebop.
Music scales could be seen as tools for creating music, including improvisation. Music keys, on the other hand, is more a way to describe music.