How do I find out where a child is with javascript

I want to make a parent move to an object when space is pressed and I don’t know how to do that, please help

Use the transform.position on each one as they are in world coordinates

I’m unsure what part of this problem you are having trouble with. You can fixup the link to the child in the inspector so that the parent has a reference, or you could use Transform.Find() to find a specific child on a known path, or you can search all the children of a transform for a specific child. After you’ve found the child, it is a bit tricky to move the parent to the child since moving the parent will also move the child. You could do something like:

pos = child.position;
transform.position = Vector3.Lerp(transform.position, pos, Time.deltaTime * speed);
child.pos = pos;

This will move the parent to the child over time with an eased movement. You could also avoid the moving child issue by temporarily breaking the parent/child relationship and reestablishing it when the move is complete.link text

To find a child, use the transform.Find() function, then move your child.

var child = transform.Find("NameOfChild");

transform.Translate(child.transform.position);