Trying to Use Object Pooling(UnityEngine.Pool) together with an array of game objects and it's not working

I’m trying to create an object pooling that can store an array of 3 game objects. Those 3 game objects are chosen randomly using a Random.Range. I don’t see any error or red lines in my code yet it wont work on my Unity Editor. Whenever I press F The console command says:

image
I have 2 Codes that both call each other. The code here is where the array is created and also where the 3 game objects is referenced.

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

public class AnimalSpawnerScript : MonoBehaviour
{
    [SerializeField]  
    private int _maxRandomXRange = 3;
    private int _minRandomXRange = 0;
    private int _randomAnimalSelector;
    Vector3 _randomAnimalSpawnSelector;
    
    public AnimalScript[] _animalPrefabs;
    public ObjectPool<AnimalScript> _animalObjectPooling;
    public AnimalScript _animalScript;

    // Start is called before the first frame update
    void Start()
    {
        //setup to call AnimalScript
        _animalScript = GetComponent<AnimalScript>();

        //setup for object pooling
        _animalObjectPooling = new ObjectPool<AnimalScript>(CreateAnimal, OnTakeAnimalFromPool, OnReturnAnimalToPool, OnDestroyAnimal, true, 30, 60);
    }

    // Update is called once per frame
    void Update()
    {
        SpawnAnimal();
    }

    //spawns animal
    private void SpawnAnimal()
    {
        if(Input.GetKeyDown(KeyCode.F))
        {
            _animalObjectPooling.Get();
        }
    }

    //instantiates game object if pool is empty
    private AnimalScript CreateAnimal()
    {
        
        _randomAnimalSpawnSelector = new Vector3(Random.Range(_minRandomXRange, _maxRandomXRange), 1, 30);

        AnimalScript animal = Instantiate(_animalPrefabs[_randomAnimalSelector], _randomAnimalSpawnSelector, _animalScript.transform.rotation); //line 49 where console detects the problem
        Debug.Log("instantiating animal");

        _animalScript.SetPool(_animalObjectPooling);

        return animal;
    }

    //takes from the pool
    private void OnTakeAnimalFromPool(AnimalScript animal)
    {
        //set transform and rotation
        _animalScript.transform.position = _randomAnimalSpawnSelector;

        //activate
        _animalScript.gameObject.SetActive(true);
    }

    //release from the pool
    private void OnReturnAnimalToPool(AnimalScript animal)
    {
        animal.gameObject.SetActive(false);
    }

    //destroys gameobject if pool reaches maximum capacity
    private void OnDestroyAnimal(AnimalScript animal)
    {
        Destroy(animal.gameObject);
    }

}

Those 3 game objects share the same script pasted below here:

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

public class AnimalScript : MonoBehaviour
{

    [SerializeField] 
    private float speed = 15.0f;
    private int _outOfBounds = -5;

    public ObjectPool<AnimalScript> _pool;

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        AnimalMovement();
        AnimalDeath();
    }

    //animal movement
    private void AnimalMovement()
    {
        transform.Translate(Vector3.forward * speed * Time.deltaTime);
    }

    //destroy animal on specific location
    private void AnimalDeath()
    {
        if (transform.position.z <= _outOfBounds)
        {
            _pool.Release(this);
        }
    }

    public void SetPool(ObjectPool<AnimalScript> pool)
    {
        _pool = pool;
    }
}

This is what it look in the editor:

For added context this is the video guide I based my pooling out of:

Hi!
During your animal creation process, there are a couple of things to comment. First, the rotation of the object you are instantiating is taken from the variable _animalScript. If that variable is not set in the inspector (or from any other script), you get the current error.

In addition, you are not assigning the pool reference to the new instance, but to the generic variable _animalScript, so your animal will never return to the pool.

Here is a version that should work:

private AnimalScript CreateAnimal()
{
    _randomAnimalSpawnSelector = new Vector3(Random.Range(_minRandomXRange, _maxRandomXRange), 1, 30);

    var randomAnimalPrefab = _animalPrefabs[_randomAnimalSelector];

    // I use the rotation of the prefab, but you can use the rotation of any existing object
    var animal = Instantiate(randomAnimalPrefab, _randomAnimalSpawnSelector, randomAnimalPrefab.transform.rotation);

    // We make sure the pool reference is assigned to the instance created
    animal.SetPool(_animalObjectPooling);

    return animal;
}

Besides that code, there is another important aspect to revisit. Inside the method OnTakeAnimalFromPool, you receive the pooled animal, but what you are editing inside is the general variable _animalScript, not the information of the animal instance coming from the pool. If you want to update the properties of the animal coming from the pool (which would make total sense), you’d need to update the method as follows:

private void OnTakeAnimalFromPool(AnimalScript animal)
{
    // Set transform and rotation to the animal coming from the pool
    animal.transform.position = _randomAnimalSpawnSelector;

    // Activate the animal coming form the pool
    animal.gameObject.SetActive(true);
}

In general, it seems that there is a bit confusion between the AnimalScript of the elements in the pool, and the _animalScript variable you have in your spawner, that looks unnecessary.