How to change an int in a different class (for score)

So what i’m trying to achieve is that everytime a zombies health reaches 0 the players score is increased by one. I currently have no clue why this sin’t working. Here is my code

Code within the enemy class:

if (health <= 1) {
					
			SurvivalScore SS = (SurvivalScore)target.GetComponent ("killscore");
			SS.killscore (+1);

}

Code within the scoring system:

public int zombieskilled

public void killscore(int adj) {

		zombieskilled += adj;

}

Any help will be appreciated as currently the score is always displayed at 0.

Assuming that SurvivalScore is the name of the scoring system script, then you could do it this way.

First declare the variable at the top of the script in the enemy class.

SurvivalScore SS;

Then you would make the reference in the Start function like this.

void Start() {
     SS = gameObject.GetComponent<SurvivalScore>();
}

Now you’re able to call the killscore function via the reference you just made like this.

if (health <= 1) {
         SS.killscore(1);
}

Let me know if this helped you.