Does not exist in current context

I am referencing a script from another object. I am using the FindObjectOfType(); and of course the object is ScoreManager. Yet, I get a does not exist error in connection with the float that I am trying to work with.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using system;
public class PowerupsManager : MonoBehaviour {

        private bool doublePoints;
        private  bool safeMode;

        private bool powerupActive;

        private float powerupLengthCounter;

        private ScoreManager theScoreManager;

       

    // Use this for initialization
    void Start () {
            theScoreManager = FindObjectOfType<ScoreManager>();
       
    }
   
    // Update is called once per frame
    void Update () {

        
            if(powerupActive)
            {
               powerupLengthCounter -= Time.deltaTime;

               if(doublePoints)

               {

                theScoreManager.pointsPerSecond = normalPointsPerSecond * 2;
               }

               if(powerupLengthCounter <= 0)

                {
                  theScoreManager.pointsPerSecond = normalPointsPerSecond;
                  powerupActive = false;
                }
             }
        
    }

       public void ActivatePowerup(bool points, bool safe, float time)

       {

        doublePoints = points;
        //safeMode = safe;
        powerupLengthCounter = time;

        normalPointsPerSecond = theScoreManager.pointsPerSecond;
       
        powerupActive = true;
       }

}

I have got it to work although I am not sure if my solution is the best one. I changed the float that it was referencing from a private to a public float and changed normalPointsPerSecond to theScoreManager.normalPointsPerSecond.

Your solution is correct, at least that’s how I would pass the float. If you keep it as a private float, it is only accessible within that class, hence the error ‘does not exist in current context’, which means, the context of that class, and all available public variables.