How do I stop my character from sliding.

using UnityEngine;

public class Slide : MonoBehaviour
{
public float slidespeed;
public float maxslidedistance;
public bool issliding;
public float slidetimer = 0;
public float maxslidertimer = 1f;

void slide()
{
    if (Input.GetKey(KeyCode.LeftShift) && Input.GetKey("x"))
    {
        issliding = true;
    }
    else
    {
        issliding = false;
    }

    if (issliding)
    {
        slidetimer += Time.deltaTime;

        transform.position += transform.forward * 9 * Time.deltaTime;
    }
    else
    {

    }

    if (slidetimer >= maxslidertimer)
    {
        issliding = false;
        slidetimer = 0;

    }
}

}

Jonathan,

Great question. I think what is happening is that you are not giving Unity enough time to render. The else statement with issliding = false may be throwing off the program.

If you are calling this void slide() I would just write it this way:

void slide()
 {
     if (Input.GetKey(KeyCode.LeftShift) && Input.GetKey("x") && issliding == true)
     {
          slidetimer += Time.deltaTime;
         transform.position += transform.forward * 9 * Time.deltaTime;
     }
     if (slidetimer >= maxslidertimer)
     {
         issliding = false;
         slidetimer = 0;
     }
 }

this would be a clearer set up, and wherever you are calling the slide() from, prior to calling it I would add issliding = true; this way you are entering the slide() function with issliding = true;

Let me know if that makes sense. =)