duplicated object destroyed when original object destroyed

hi…i am new to unity…i have a banana prefab tagged as “ban”. now have a problem with collider that is a trigger. i written a score system program on it and it works good.but, the problem is that i duplicated the object which has same tag.when i collide with my player the original of the banana prefab increases the score…but not duplicated prefabs increasing it.
i am using this script on that prefab :

public void OnTriggerEnter(Collider hit)
	{
		if (hit.gameObject.CompareTag("player")) 
		{
			sc += 5.0f;
			score_value.text = ((int)sc).ToString ();
			Destroy (this.gameObject);
		}
	}

Is there any solution for this? (please…it’s urgent :frowning: )!!!

You check for Player tag on hit object but then proceed to destroy the GO attached to ‘this’ which refers to the script you are reading. So the GO the script is on is destroyed.

Try hit.gameObject instead of this.gameObject if thats what you are trying to achieve.

For all objects to update the same scoreboard you need to grab the actual scoreboard with GetComponent to access the same information.