Turning off Mesh Renderer of Childed Objecs

Hey guys! I want to create a weapon switching system for my multiplayer game, and I don’t think that setting objects on and off (active) will work this time. I was wondering if anyone could show me how to turn of the mesh renderer of the children of an object in a script. Thank you in advance!

tag your weapon as “gun”
that should work. If not try this link. Cycle weapons with only ONE key press (spacebar) - Unity Answers

function Update ()
{
    if Input.GetKeyDown("space"){

    var gun = GameObject.FindWithTag("gun");
 
    renderer.enabled = false;
 }
}