GameObject changes position when made a child.

in my game there is a unit who at some point is made a child under another object. when this happens my child object aligns its self with the parent object which is strange to me. I don't want it to move when it becomes a child, can you help me? here's that part of my code:

    moo = Instantiate(genmover, midpoint, Quaternion.identity);//genmover is a character controller, and midpoint is just a point I have defined above.
    moo.transform.name= "mover" + hutu;//hutu is a string, no problem here.
    moo.transform.parent = gameObject.Find(typeis_+"bots").transform; //typeis*+"bots" adds up to some gameobject name that in the game and its the parent of moo. but*_ 
_*//moo becomes a parent here in a sec, and it's child is the one that moves.*_ 
 _*gameObject.Find("Girlbots/"+numberstring).transform.parent = moo.transform;*_
_*//this is the part where my gameobject becomes a child under moo.*_
_*//it is at this point that the gameObject relocates. why? and how do I get it to stop?*_
_*```*_

Changing the parent of a transform does not affect the transform's world position or rotation. The local position and rotation of the child is automatically modified so that the object remains in the same world-relative space and orientation.

I have many scripts which rely on this, and in fact I also have some scripts where I want to preserve the object's local transform instead, and it's in these cases where I must correct the values localPosition and localRotation after parenting - not the other way around. This behaviour is also documented.

This means there must be a problem somewhere else in your code - perhaps there's a script attached to your "genmover" prefab which moves it in its "Start" function? If so, that script would execute after all the current Update scripts of the current frame have finished which would perhaps make it seem as though it's moving as a result of the script you're looking at.