Problems with OnCollisionEnter

Hi! So I have a script that transports my player to a desired location if it collides with a certain object, and that is working fine, but now the player can go through walls. The player is a rigidbody and the wall is a collider. Any thoughts on what could be going wrong?

Here’s my code, which is attached to the objects that cause the player to transport upon collision:

function OnCollisionEnter (other : Collision) {
	if (other.collider.name == "Player") {
		other.collider.transform.position = spawnPoints[index].transform.position;
		other.collider.transform.rotation = spawnPoints[index].transform.rotation;
		index++;
	}
}

Note: I tried changing the script so that it was attached to the player, and that worked in terms of the transportation, but didn’t solve the walking through walls problem. Any help would be appreciated!

Sorry I figured it out and it was a silly problem! I had checked freeze position for x, y, and z when I should have been freezing rotation.