How would I get a variable from another script that's inside a method?

How would I be able to access this variable that is inside of a method from another script OR move it outside of the script (Since it seems to only work inside the script)

(The script that holds the variable)

    public void SpawnRandomZombie()
    {
        //Here is the variable I'm trying to access from the other script. I would either
        //want to access it from inside the script or move it outside the script which
        //I dont know how to do
        int rrifziNumber = RRIFZI();

        if (detectCollisionsScript.gameOver != true)
        {
            Debug.Log("SpawnManager Script " + rrifziNumber);

            Instantiate(zombiePrefabs[rrifziNumber], RandomSpawnPos(), zombiePrefabs[rrifziNumber].transform.rotation);
        }

    public int RRIFZI()
    {
        //RRIFZI Stands for ReturnRandomIntFromZombieIndex, Just an abbreviation so its shorter
        int zombieIndex = Random.Range(0, zombiePrefabs.Length);
        return zombieIndex;
    }

(The script thats trying to access the variable above)

    void ZombieStats()
    {
        //The rrifziNumber is giving me an error CS1061
        Debug.Log("ZombieAI " + spawnManagerScript.rrifziNumber);
    }

You can’t access a local variable like this. Either make this variable a public member variable or return it as a result of the function.
Go to the line where “SpawnManagerScript” class starts and write:
public int rrifziNumber;
and remove int from rrifziNumber in SpawnRandomZombie method.
This way, you can access the variable. By the way, you should name your variables and methods clearly. Instead of RRIFZI, you can name it as GetRandomZombieIndex. It doesn’t need to be shorter. It needs to be readable.