If player collides with game object enable renderer of other game object

so im using this script to enable the renderer of a gun that is invisible but the gun is attached to the player, so i want the gun to be visible whenever i collide with other game object but whenever i collide they wont show…i guess its cause the gun doesnt collide with the object,…the player is the one that collides with the object i dont know if u understand my problem…so basically what i want to do is access this script but whenever the player collides! thanks!
-Goatria

renderer.enabled = false;

function OnTriggerEnter(hit : Collider)
{
renderer.enabled = false;
if(hit.gameObject.tag==“Multiple”){
renderer.enabled = true;
}
}

You can use a static bool.

I think what you need/want is to reference the guns transform so you can change it’s renderer whenever you want;

var gun : Transform;
function Start(){
      gun.renderer.enabled = false;
}
function OnTriggerEnter(hit : Collider){
      gun.renderer.enabled = false;
      if(hit.gameObject.tag=="Multiple"){
            gun.renderer.enabled = true;
}
}

P.s. Also when posting code in the future please remember to use the CODE tags.

thanks King it worked!