Reference a function from another object

I know this has been asked a lot, but none of the other questions have worked. I have a function called getPlayer() in a spawn script which returns the player. In the first line, I’m trying to get the object that has the player script, but it doesn’t let me drag a GameObject from in the scene into it. var SpawnLoc : GameObject; private var spawn : MonoBehaviour; spawn = SpawnLoc.GetComponent(Spawn);

Because you cannot convert a monobehavior to a script. If you just need the script just use…

var variableName : Scriptname;

Then drag the object wih that script to it in the inspector and unity will handle it from there