The easiest would be to store the position (and rotation) of the object in the Start function, and use it to spawn the object:
(I am not a native JavaScript speaker, so the syntax might be a bit off). The following must be in the same script as the function SpawnAnother in your code.
var initialPosition : Vector3;
var initialRotation : Quaternion;
function Start()
{
initialPosition = transform.position;
initialRotation = transform.rotation;
}
function SpawnAnother()
{
var localObject : GameObject = Instantiate(gameObject, initialPosition, initialRotation);
localObject.GetComponent(moveTarget).speedLeft = myCounter + 2;
localObject.GetComponent(moveTarget).speedRight = myCounter + (-2);
}
(P.S. I am not sure why you had gameObject as parameter for instantiate - I am assuming here that you want to clone the attached object, so I replaced it with gameObject).
So UIButton is a prefab which has a script on it called UIButtonFunctions which has a public GameObject variable called spawnOrigin.
I instantiate UIButton by assigning a variable to it first (i.e. “newUIButton”) then access and assign spawnOrigin via referencing the newUIButton variable.
Hope this helps someone else struggling with this.