last collision detection?

I’m trying to create a Pong game with 4 players. I need to make the scores, so if player01 last hit it and then touches one of the walls, player01 will get the point. But i don’t know how to make it check the last player that touched the ball?

This is what i tried to do:

function OnCollisionEnter2D (colInfo : Collision2D) {
if(colInfo.collider.tag == “Player01”){
gameObject.tag = “Player01C”;
}
}

Set up a bool

player1LastCollision : boolean = false;
player2LastCollision : boolean = false;

function OnCollisionEnter2D (colInfo : Collision2D) { if(colInfo.collider.tag == "Player01"){ 
player1LastCollision  = true; 
player2LastCollision  = false; 
}
if(colInfo.collider.tag == "Player02"){ 
player2LastCollision  = true;
player1LastCollision  = false; 
} 
}

Then in Update check for the bool and add score++ if true.

So I am asuming that this script is on the ball and you want it to give points the player that most recently touched it, upon hitting a wall?

 `var mostRecentPlayer : PlayerPointStuff; 
    function OnCollisionEnter2D (colInfo : Collision2D)
     {
     if(colInfo.collider.tag == "Player") //just give all the players the same tag. 
    { 
    mostRecentPlayer = colInfo.collider.GetComponent(); //i am having problems with this boards code stuff, but just get the component of the players Point script(player point stuff)
    }
     }`

and then when the ball hits a wall just add points tothe mostRecentPLayer(it will always update to the most recent).