The key signature allows the composer to use less accidentals which makes the music less cluttered. Just like the other person who answered this said when a score with multiple instruments is written it is almost always all in the same key to keep the music organized (their answer is better)