Get variable from other script

I know there’s been a lot of questions about that but nothing that i found worked here… So in my game i have some random object and when its mouse clicked i want to draw a variable called name somewhere on the screen, but i get 2 errors.

//Pllayers script
//1.Ambiguous reference 'name': Info.name, UnityEngine.Object.name.
var Info : Info = target.GetComponent(Info).name;
//I have variable name in this script Info.
//2.An instance of type 'Targeting' is required to access non static member 'target'.
Targeting.target = gameObject;
//Here i cannot assign the target which is a variable from the player's script
var Targeting : Targeting = player.GetComponent(Targeting); 
//Thats how i got this variable

Ambiguous reference ‘name’: Info.name, UnityEngine.Object.name.

Just choose any other name for your variable (“name” is a reserved one).

An instance of type ‘Targeting’ is required to access non static member ‘target’.

You’re trying to access static variable there (Class.variable form) and looks like you have no such static variable declared in your Targeting class.

I’d suggest to re-write it like this (if I correctly understood what you’re trying to achieve):

var targeting : Targeting = player.GetComponent(Targeting);
targeting.target = gameObject;