How to get X scale from a child prefab with tag?

I need to find the X scale of a prefab child with a tag how do i do this?

this is what i tried i dont know if this would work in any way but ill post it just as reference of what i use

    public void SpawnNextPlatform()
    {
        if (!Spawned) {
            Spawned = true;
            int spawnthis = Random.Range (0, Possible.Length);


            //THIS IS WHAT I NEED TO HAVE FIXED/WORKING
            foreach (Transform child in Possible [spawnthis])  //Possible is a GameObject Array
            {
                if (child.gameObject.tag == "LongestPart")
                {
                    Distance = child.localScale.x;
                    Debug.Log("TEST");
                }
            }
            //==============================================
            Instantiate (Possible [spawnthis], NextCords, CurrentRot);
        }
    }

why are you after the scale? to determine the child’s size?

scales are annoying in that they are all held as “local” variables so they are relative to the parent. To determine the overall “scale” of a given child object in the scene you have to combine all the local scales of all the ancestor gameobjects in it’s hierarchy…

im making a infinite runner and now i need to make them x amount long i want to find the x scale from the longest part and use that instead of a set value so i can make longer/shorter parts if i want to

as above, if you want to determine the overall scale of a child you need to iterate over the child and it’s ancestors to combine all the local scales.

Alternatively you might be able to use the “bounds” Unity - Scripting API: Bounds
just be aware of the “rotation caveat” in there.