Trying to play sound when key is pressed

Im trying to play sneakSound when space bar is pressed, which it is but its keeps playing every frame, I’ve tried Input.GetKeyDown, but then the color change that happens only shows for one frame and it needs to be active when space bar is held down.

Here is the Code

You don’t really need to set the color every frame I assume? So you can set the color and play audio on KeyDown and then change the color back on KeyUp. Something like this:

if(Input.GetKeyDown("space")) {
    this.renderer.material.SetColor("_Color", Color.gray);
    audio.PlayOneShot(sneakSound);
}
else if(Input.GetKeyUp("space")) {
     this.renderer.material.SetColor("_Color", Color.white);
}