How do i stop my player from sliding down slopes.

I have been trying to add slopes for my game when I noticed that my player sides down, I tried different ways of preventing this (too many to list) and nothing seems to be working.
Here’s my code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class fpsmover : MonoBehaviour
{

    // Start is called before the first frame update
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
        obj = GameObject.Find("camdirect");
        speedbost = GameObject.Find("SpeedBost");
        damagebost = GameObject.Find("DamageBost");
        rb = GetComponent<Rigidbody>();
    }
    GameObject obj;
    public GunShot script;
    GameObject speedbost;
    GameObject damagebost;
    Rigidbody rb;
    public float Speed = 10f;
    public float Health = 100f;
    public float SpeedBost = 2f;
    public float DamageBost = 2f;
    public float sensativity = 10.0f; //the speed we rotate to look at diffrent stuff
    // Update is called once per frame
    void Update()
    {
        Vector3 objPosition = new Vector3(obj.transform.position.x, transform.position.y, obj.transform.position.z);
        transform.LookAt(objPosition);
        float horz = Input.GetAxis("Horizontal");
        float vert = Input.GetAxis("Vertical");
        Debug.Log(horz);
        float x = horz * Speed * Time.deltaTime;
        float z = vert * Speed * Time.deltaTime;
        this.transform.Translate(x, 0.0f, z);

What’s the point of using a Rigidbody if it cannot be in control of the Transform? You’ve taken control so how is it supposed to write the physics poses to the Transform if you’re stomping over it? Also oddly, physics (by default) runs per fixed-update and you’re modifying the Transform per-frame.

You are supposed to effect changes in Transform position by going through the Rigidbody API.

If you understand a little Spanish, this video will help you.