Why won't my suspension script work when using arrays?

Alright, so I have a script for my car which is just the suspension so far. And this script is on the “R32 Multi Raycast”, 201483-image.png every time I try testing the car’s suspension it doesn’t work because its too bouncy and I’ve tried changing the values around and it still doesn’t work. But, whenever I duplicated the R32 Car and put the script into each individual wheel transform and for some reason that one works. How can I fix the script so that it works when the script is in the “R32 Multi Raycast” gameobject?
Script:

    private Rigidbody rb;
    [Header("Suspension")]
    public float restLength;
    public float springTravel;
    public float springStiffness;
    public float damperStiffness;

    private float minLength;
    private float maxLength;
    private float lastLength;
    private float springLength;
    private float springForce;
    private float damperForce;
    private float springVelocity;

    private Vector3 suspensionForce;

    [Header("Wheel")]
    public float wheelRadius;
    public Transform[] wheels;
    private Vector3 wheelHubPOS = new Vector3(0, -0.7f, 0);

    void Start()
    {
        rb = GetComponent<Rigidbody>();
        minLength = restLength - springTravel;
        maxLength = restLength + springTravel;
    }

    void FixedUpdate()
    {
        foreach(Transform w in wheels)
        {
            if (Physics.Raycast(w.position, -w.up, out RaycastHit hit, maxLength + wheelRadius)) {
                lastLength = springLength;

                springLength = hit.distance - wheelRadius;
                springLength = Mathf.Clamp(springLength, minLength, maxLength);
                springVelocity = (lastLength - springLength) / Time.fixedDeltaTime;
                springForce = springStiffness * (restLength - springLength);
                damperForce = damperStiffness * springVelocity;

                suspensionForce = (springForce + damperForce) * w.up;

                rb.AddForceAtPosition(suspensionForce, hit.point);
            }
        }
    }

Sorry for the messy title didn’t really know what to title it. Thanks in advanced! (Also this script is the one that’s only in the R32 Multi Raycast Empty Gameobject, the only difference with this script and the one inside the wheels is that i don’t use “foreach” i just use “transform.position” to reference the wheel)

The problem is a single “lastLength” value being used for all wheels, so the spring velocity is calculated correctly only if there’s one wheel in the array. Otherwise you’re comparing current spring length with the one from the previous wheel, not the current wheel. You need to store and use one lastLength value per each wheel.