How to click on single instance of object?

In my game, I have about 20 triangles and have code that says when I click on a triangle, its scale changes, however this changes the scale of every single triangle and not just the single one I click on. This is the code I’m using:

		if (Input.GetMouseButtonDown (0)) {
			RaycastHit2D hit = Physics2D.Raycast (new Vector2(Camera.main.ScreenToWorldPoint (Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y),, 0f);
			if (hit.collider != null) {
				transform.localScale = new Vector2 (-1,1);

How can I make it so that only the single triangle I clicked on will be affected?

change the local scale of hit.collider.transform, not transform. Attach this script to one gameobject in the scene, NOT to all triangles.

p.s. use overlappoint instead of raycast. pass the vector3 of ScreenToWorldPoint directly as parameter, it will be cast automatically