getting position from a script

i’ve been on this for hours now and i can’t figure it out one bit, i am trying to get the position of the object from TileST but i can’t figure it out here’s my scripts

MoveST

function Update () {
var hit: RaycastHit;
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);	

if (Input.GetMouseButtonDown(0)) {
	if(Physics.Raycast(ray,hit,50)){
	if(hit.collider.tag == "flat"){
	transform.position = new Vector3 (hit.transform.gameObject.GetComponent(TileST));	
}}}}

TileST:

#pragma strict
var xlocation : float;
var zlocation : float;

function Update () {
xlocation = transform.position.x;
zlocation = transform.position.z;
}

The TileST component is not going to have a different position than the transform. That is the transform you are trying to access through the script is just another component on the same game object as the TileST component and it this case is ‘hit.transform’. So you can just do:

transform.position = hit.transform.position;

Just for chuckles, if you wanted to get the position through TileST, it would be:

transform.position = hit.transform.GetComponent(TileST).transform.position;

If u want the xlocation and zlocation from TIleSt then…

var tile_St :TileST

if(hit.collider.tag == "flat"){ tile_St=hit.transform.gameObject.GetComponent(TileST)); transform.position = new Vector3 (tile_St.xlocation,0,tile_St.zlocation); }