Need help on a procedural animation issue

Hi everyone. I’m following this tutorial on procedural animation, and I’m stuck on point 6, on moving the leg to the target position.

In the first attached video, I’m checking the distance, and if it exceeds the threshold, changing the position.

In the second video, the distance checking logic is turned off, instead it shows that the position changes correctly when running the engine.

And the script (for second video the if (distance > moveThreshold) is commented, while the body remains the same:

using UnityEngine;

public class DrawTargetGizmo : MonoBehaviour
{
    [SerializeField] private GameObject bone;
    [SerializeField] private GameObject target;
    [SerializeField] private LayerMask legLayer;

    [SerializeField] private float moveSpeed = 10f;
    [SerializeField] private float moveThreshold = 1.5f;

    private void Update()
    {
        if (bone == null) return;

        float distance = Vector3.Distance(bone.transform.position, transform.position);

        if (distance > moveThreshold)
        {
            Vector3 currentWorldPos = bone.transform.position;
            Vector3 targetWorldPos = target.transform.position;

            Vector3 newWorldPos = Vector3.MoveTowards(currentWorldPos, targetWorldPos, 5f * Time.deltaTime);

            bone.transform.position = newWorldPos;
        }  
    }

    private void OnDrawGizmos()
    {
        Gizmos.color = Color.red;
        Gizmos.DrawSphere(transform.position, 0.15f);
    }
}

Any help would be appreciated, thanks!