You can change whether you want to have external sounds recorded or muted when using QuickTime screen recording.
To change the sound settings, click on the downwards arrow next to the Record button. Under the Microphone headline you can select None or Internal Microphone. If you choose None, the recording will only play the sounds from any current processes on your Mac. If you choose Internal Microphone, you’ll be able to record your voice and other external sounds when making the screen recording.
If you have general issues with computer sound, we've got you a detailed guide on how to fix sound on your Mac.