How would I find the location of a GameObject I have an instance of?

So I tried doing this script to make one objects position the same as the player’s at all times, but I keep getting the error “‘transform’ is not a member of ‘Object’”

#pragma strict

var PlayerOBJ;

function Start () {
	PlayerOBJ = GameObject.FindWithTag("Player");
}

function Update () {

	transform.position(PlayerOBJ.transform.position.x,PlayerOBJ.transform.position.y, PlayerOBJ.transform.position.z);
}

#pragma strict

var PlayerOBJ : GameObject;
 
function Start () {
PlayerOBJ = GameObject.FindWithTag("Player");
}
 
function Update () {
 
transform.position = Vector3(PlayerOBJ.transform.position.x,PlayerOBJ.transform.position.y, PlayerOBJ.transform.position.z);
}

Typecasting PlayerObj as a GameObject seems to fix the problem. Also, you may need to add “= Vector3” to your last line of code like I did.

#pragma strict

var PlayerOBJ : GameObject;
 
function Start () {
    PlayerOBJ = GameObject.FindWithTag("Player");
}
 
function Update () {
    transform.position = PlayerOBJ.transform.position;
}

Edit: Didn’t realize Oniony already answered. But yeah when you don’t specify that PlayerOBJ is of type GameObject, it will automatically be determined as being of type Object which obviously doesn’t have a transform. You also don’t have to manually do each axis, just saying one transform position is equal to another transform position works as a shorthand.