Uniting 2 integers from two different sources

Hello All

I have same script on many instances of game objects.
Once the gameobject is shot the script sends to a reference script a score.
Hence the reference script is responsible for counting the scores based on the “death” of the shot gameObject.

Recently I had to place the reference script on one more game object, and now I have two instances of this script in the scene, each one of them is instantiating different number of objects I need to shoot in my game.

Now, when I shoot a gameobject instead of having the score go: 1,2,3,4,5,6,7…
The score goes like: 1,2,3,4,5,1,2 - this is because the count happens on boths scripts and is sent to one canvas that is updated due to the script that sends the method.

My Question is then: Is there a way to have the count save a current integer as a score and update this integer regardless the origin of the game object ?

Your scripts/classes are better if do one specific job. You simply need to create one more script, specific and dedicate to score count, those 2 “reference scripts” (I suppose they act like spawners), and they should should report (forward) deaths to this new “master count script” which you can use then in some UI for example.