Instantiate as a child at position

Alright so I’m trying to instantiate a gameobject as a child of another game object so that they will move together.

I also want it to be created in the center of the parent gameobject.

here is my code so far:

zap.transform.parent = transform;

where zap is the game object I want to create.
When I run this code it is run without an error, but I can’t find the gameObject it has created and it doesn’t seem to have become a child either.
The gameObject instantiating zap is the object running the script.
thank you

var newObj : Transform = Instantiate (zap, transform.position, transform.rotation) as Transform;
newObj.parent = transform;

//for who checking this answer after couple of years
//Instantiate as a child at position
GameObject myPrf= Instantiate (myPrefab, transform.position - new Vector3(0,0,0), Quaternion.Euler(0, 0, 0));
myPrf.transform.parent = transform;