DropZone script doesn't work when gameObject is rotated

Hi, i’m trying to make a 2d card game (poker style). i’d like to simulate some kind of “hand”. for the moment all it does is rearanging all the childs of the gameObject which my script is attached to. but it doesn’t work well when my gameobject is rotated. I’d like all my cards to be facing the center of the table depending on the rotation and position of their parent (which is just a gameObjet with a transform and the script attached to it) .

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DropZone : MonoBehaviour {

    [SerializeField]
    float radius = 10;

    [SerializeField]
    float offset;

    [SerializeField]
    int _nbElements;

//    [SerializeField]
//    Transform[] childs;

    void arrangeChilds(){

        _nbElements = transform.childCount;

        if (_nbElements == 0)
            return;
        else if (_nbElements == 1) {

            for (int i = 0; i < _nbElements; ++i) {
             
                Transform child = transform.GetChild(i);

                if (child != transform)
                    child.position = transform.position;
            }
             
        } else {
            float distance = ((radius + offset) / _nbElements);
            float startX = (transform.position.x - (radius / 2)) + (distance / 2);

            for (int i = 0; i < _nbElements; ++i) {
                Transform child = transform.GetChild(i);

                if (child != transform) {
                    Vector3 temp = new Vector3 (startX, transform.position.y, transform.position.z);
                    child.position = temp;
                    startX += distance;
                }
            }
        }
    }

    void Start(){
        arrangeChilds ();
    }
}

Allright i found the solution. I changed lines 37, 43 and 44. And it took me time to realise that position and localposition weren’t the same thing. I thought position would actually return the position relative to the parent.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DropZone : MonoBehaviour {

    [SerializeField]
    float radius = 10;

    [SerializeField]
    float offset;

    [SerializeField]
    int _nbElements;

//    [SerializeField]
//    Transform[] childs;

    void arrangeChilds(){

        _nbElements = transform.childCount;

        if (_nbElements == 0)
            return;
        else if (_nbElements == 1) {

            for (int i = 0; i < _nbElements; ++i) {
              
                Transform child = transform.GetChild(i);

                if (child != transform)
                    child.position = transform.position;
            }
              
        } else {
            float distance = ((radius + offset) / _nbElements);
            float startX = (0 - (radius / 2)) + (distance / 2);

            for (int i = 0; i < _nbElements; ++i) {
                Transform child = transform.GetChild(i);

                if (child != transform) {
                    Vector3 temp = new Vector3 (startX, 0f, 0f);
                    child.localPosition = temp;
                    startX += distance;
                }
            }
        }
    }

    void Start(){
        arrangeChilds ();
    }
}