Character sliding over terrain.

My 3d character slides down when terrain have a little inclination. I want to stop this.
This is my script to control character movement:

    float rotation;
public float MoveSpeed = 3;
public Rigidbody rb;
// Use this for initialization
void Start () {
	rb = GetComponent <Rigidbody>();
} 

// Update is called once per frame
void Update () {

	if (Input.GetKey (KeyCode.LeftShift)) {
		MoveSpeed += 2;
	} else {
		MoveSpeed = 3;
	}

	if (Input.GetKeyDown (KeyCode.Space)) {
		rb.velocity = new Vector3 (0.0f, 5, 0.0f);
	}

	rotation += PlayerCamera.speedH * Input.GetAxis ("Mouse X");
	transform.eulerAngles = new Vector3 (0.0f, rotation, 0.0f);
	transform.Translate (Vector3.right * Input.GetAxis ("Horizontal") * MoveSpeed * Time.deltaTime);
	transform.Translate (Vector3.forward * Input.GetAxis ("Vertical") * MoveSpeed * Time.deltaTime);
} 

void OnTriggerEnter (Collider col) {
	
	transform.Translate (new Vector3 (transform.position.x, transform.position.y, transform.position.z));
	}

I had the same problem recently. After changing my characters capsule collider’s material to FrictionPhysicsMaterial, the sliding finally stopped and I could keep it in place at slightly angled surfaces.

Hope this helps

Change the collider plane vector y to a more much number.