How to get object to follow the player?

I tried to make a script where instantiated objects would follow the player, but instead all of the objects go to the same place and get stuck even if they don’t have a collider.

 public Transform player;
    public float speed = 5f;

    private void Update()
    {
        if (player != null)
        {
            Vector2 direction = player.position - transform.position;
            transform.Translate(direction.normalized * speed * Time.deltaTime);
        }
    }