Plucking a guitar string is an example of transverse wave of string vibration, while sound produced by it gives you a longitudinal wave in the air.
When we pluck the string of a guitar, the music is produced due to