cant reference unity scripts in one game, but exact same code works in other game

I’m trying to access a variable from a script and it comes back as null reference exception every time, ive tried accessing this exept variacle 50 different ways but get the same thing back everytime, addcomponent and FindObjectOfType get me the same result. Here is my code, h is just from my character controller script which i will show after the counter script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;


public class Counter : MonoBehaviour {
    
    private Text numeber;
    private Characterbehavior gj;
    
    // Use this for initialization
    void Start () {
       
       
	}
	
	// Update is called once per frame
	void Update () {
     
        
     numeber.text = gj.candyKainz + "/100";
        
	}
}

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

public class Characterbehavior : MonoBehaviour
{
private Animator anim;
public float moveSpeed;
private bool playerMoving;
private Rigidbody2D rigidBoi;
private Vector2 lastMove;
public Vector3 place;
public float life;
private float skeldamage;
private bool hit;
public float hitboxtime;
Transform camera;
private SpriteRenderer facing;
public int candyKainz;
public int player = 1;

// Use this for initialization
void Start()
{
    candyKainz = 0;
    anim = GetComponent<Animator>();
    rigidBoi = GetComponent<Rigidbody2D>();
    camera = Camera.main.transform;
    

}

// Update is called once per frame

void Update()
{

    
    camera.position = Vector3.Lerp(transform.position, place, .15f);
    place = new Vector3(transform.position.x, transform.position.y, -10);
    playerMoving = false;
    if (Input.GetAxisRaw("Horizontal") > 0.5f || Input.GetAxisRaw("Horizontal") < -0.5f)
    {

        playerMoving = true;
        lastMove = new Vector2(Input.GetAxisRaw("Horizontal"), 0f);
        rigidBoi.velocity = new Vector2(Input.GetAxisRaw("Horizontal") * moveSpeed, rigidBoi.velocity.y);
        
    }
    if (Input.GetAxisRaw("Vertical") > 0.5f || Input.GetAxisRaw("Vertical") < -0.5f)
    {

        playerMoving = true;
        lastMove = new Vector2(0f, Input.GetAxisRaw("Vertical"));
        rigidBoi.velocity = new Vector2(rigidBoi.velocity.x, Input.GetAxisRaw("Vertical") * moveSpeed);
       
    }
    if (Input.GetAxisRaw("Horizontal") < 0.5f && Input.GetAxisRaw("Horizontal") > -0.5f)
    {
        rigidBoi.velocity = new Vector2(0f, rigidBoi.velocity.y);
        
    }
    if (Input.GetAxisRaw("Vertical") < 0.5f && Input.GetAxisRaw("Vertical") > -0.5f)
    {
        rigidBoi.velocity = new Vector2(rigidBoi.velocity.x, 0f);

    }
    anim.SetFloat("MoveX", (Input.GetAxisRaw("Horizontal")));
    anim.SetFloat("MoveY", (Input.GetAxisRaw("Vertical")));
    anim.SetBool("Moving", playerMoving);
    anim.SetFloat("LastMoveX", lastMove.x);
    anim.SetFloat("LastMoveY", lastMove.y);
    

}
 void OnTriggerEnter2D(Collider2D other)
{
    if(other.gameObject.tag == "candy")
    {
        candyKainz++;
        other.gameObject.GetComponent<Candycaine>().collected();
       

    }
}

}

@slipperydemon
I have a few script changes that should fix everything. This should be your new Counter class:

public int candyKainz;
    public Text candiesText;

    void Start()
    {
        candyKainz = 0;
    }

    public void AddCandies(int newValue)
    {
        candyKainz += newValue;
        UpdateCandies();
    }

    void UpdateCandies()
    {
        candiesText.text = "Candies: " + candyKainz + "/100";
    }

This should be your new Characterbehavior class:

private Animator anim;
public float moveSpeed;
private bool playerMoving;
private Rigidbody2D rigidBoi;
private Vector2 lastMove;
public Vector3 place;
public float life;
private float skeldamage;
private bool hit;
public float hitboxtime;
Transform camera;
private SpriteRenderer facing;

//This is referencing the Counter class so you can add CandyKainz.
Counter candy;

public int player = 1;
void Start()
{
    anim = GetComponent<Animator>();
    rigidBoi = GetComponent<Rigidbody2D>();
    camera = Camera.main.transform;
    candy = GetComponent<Counter>();

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

    camera.position = Vector3.Lerp(transform.position, place, .15f);
    place = new Vector3(transform.position.x, transform.position.y, -10);
    playerMoving = false;

    if (Input.GetAxisRaw("Horizontal") > 0.5f || Input.GetAxisRaw("Horizontal") < -0.5f)
    {
        playerMoving = true;
        lastMove = new Vector2(Input.GetAxisRaw("Horizontal"), 0f);
        rigidBoi.velocity = new Vector2(Input.GetAxisRaw("Horizontal") * moveSpeed, rigidBoi.velocity.y);

    }

    if (Input.GetAxisRaw("Vertical") > 0.5f || Input.GetAxisRaw("Vertical") < -0.5f)
    {
        playerMoving = true;
        lastMove = new Vector2(0f, Input.GetAxisRaw("Vertical"));
        rigidBoi.velocity = new Vector2(rigidBoi.velocity.x, Input.GetAxisRaw("Vertical") * moveSpeed);

    }

    if (Input.GetAxisRaw("Horizontal") < 0.5f && Input.GetAxisRaw("Horizontal") > -0.5f)
    {
        rigidBoi.velocity = new Vector2(0f, rigidBoi.velocity.y);

    }

    if (Input.GetAxisRaw("Vertical") < 0.5f && Input.GetAxisRaw("Vertical") > -0.5f)
    {
        rigidBoi.velocity = new Vector2(rigidBoi.velocity.x, 0f);
    }

    anim.SetFloat("MoveX", (Input.GetAxisRaw("Horizontal")));
    anim.SetFloat("MoveY", (Input.GetAxisRaw("Vertical")));
    anim.SetBool("Moving", playerMoving);
    anim.SetFloat("LastMoveX", lastMove.x);
    anim.SetFloat("LastMoveY", lastMove.y);
}

void OnTriggerEnter2D(Collider2D other)
{
    if (other.tag == "candy")
    {
        candy.AddCandies(1);
        other.gameObject.GetComponent<Candycaine>().collected();
    }
}