Implicit downcast from 'Object' to 'String'. GetComponent from another object

Hello! I have the following script:

private var loginScr : Login;

var sysinfo : systeminfo;

function Start(){
	var persistentGameObject : GameObject = GameObject.Find("LoginObject"); // Object where Login.js is attached
    loginScr = persistentGameObject.GetComponent(Login); // The script
	print(loginScr.passvariable); // Get a variable from this script
}

and i get:

Implicit downcast from 'Object' to 'String'.

What seems to be the problem? I don’t know why does it appear. Sooner it works but now it’s crashed…

Thank you for any answer.

I think this is caused by the print. It has to convert things to a string before it can display them in the console. Perhaps loginScr.passvariable is not of type string, so behind the scenes (implicitly), it is converting (casting) this variable from object to string so it can be written.

Try removing the print and see if the error disappears.