Scoring not working for pong

on either side of the walls the score always goes to Player02 i have tried everything to change it but nothing works

this is the code below i have tried many methods especially with the PlayerScore01 += 1

#pragma strict

static var playerScore01 : int = 0;

static var playerScore02 : int = 0;

var theSkin : GUISkin;

static function Score (wallName : String) {

	if (wallName == "Right Wall")
	{
		playerScore01 += 1;
	}
	else if (wallName == "Left Wall")
		playerScore02 += 1;
	}
	Debug.Log("Player Score 1 is " + playerScore01);
	Debug.Log("Player Score 2 is " + playerScore02);

function OnGUI () {
	GUI.skin = theSkin;
	GUI.Label (new Rect (Screen.width/2-150, 25, 100, 100), "" + playerScore01);
	GUI.Label (new Rect (Screen.width/2+150, 25, 100, 100), "" + playerScore02);
}

First, is your wall correctly named?
And is the trigger at the correct position? Maybe you have duplicated the wall for player1 and forgot to move it to the right location.

Also, I think you don’t should use the name of the gameobject. I think using a bool or int is a better choice. And in the trigger script get the right value with a public var. (You can change the value of a public variable in the inspector).

public var player : int = 1;

function OnTriggerEnter2D (hitInfo : Collider2D) {
    if (hitInfo.name == "Ball")
    {
        GameManager.Score (player);
    }
}

And in the GameManger script change the parameter from String to int.

static function Score (plrNo : int) {
 
    if (plrNo == 1)
    {
        playerScore01 += 1;
    } else if (plrNo == 2) {
        playerScore02 += 1;
    }
    Debug.Log("Player Score 1 is " + playerScore01);
    Debug.Log("Player Score 2 is " + playerScore02);
}

PS: You have forgotten the closing bracket in the Score function. Look at my script. You have also forgotten the opening bracket for the else if