gameobject.renderer set to false !?

Ok , i have been searching for the past hour on why this isn’t working , everything is correct and WAS working before but for some odd reason , it isn’t budging.

function Update(){
	
	if( Shoot_script.scopedIn == true ){
	 gameObject.renderer.enabled = false;
	}
	
	if( Shoot_script.scopedIn == false ){
	 gameObject.renderer.enabled = true;
	}

}

That is literally the only code , and what happens is when i zoom in with my sniper , it disables the mesh that this script is attached to.

I have tried

gameObject.renderer.active = true;

But that fails too.

So what is happening?

Thank you

you can load in the mesh manually by adding a var like this one:

var examplemesh : Transform;

you can then drag your gameobject into this variable slot in the inspector.

finally you can use it in your code like this:

function Update(){


if( Shoot_script.scopedIn == true ){
 examplemesh.active = false;
}

if( Shoot_script.scopedIn == false ){
 examplemesh.active = true;
}

}