public class AIPerson1 : MonoBehaviour {
public Transform[ ] points;
public static int SpeedWalk = 2;
public Transform person;
public int currentpoint;
public GameObject intelligentsystem;
public GameObject pdead;
public GameObject panimation;
public float SpeedRotate = 15;
public int crash;
A static member (like SpeedWalk in your second class - “public static”) is a part of the class as a concept, not a part of each instance of the class. A static member would be shared among all copies of AIPerson1 you ever spawn. To access SpeedWalk as it is, you’d use AIPerson1.SpeedWalk.
However, I’m fairly sure it shouldn’t be static, as it appears to be conceptually linked to each individual person. So just remove the “static” part of its declaration.
There are other issues, too. You’re not using coroutines correctly (your IEnumerator AIline function). It looks like "x"s only function is to trigger that coroutine, but that should be done directly through StartCoroutine.
void OnTriggerEnter ( Collider other ){
AIPerson1 sv = Person.GetComponent<AIPerson1>();
sv.SpeedWalk=0;
StartCoroutine(AIline());
}
//REMOVE your Update function entirely
In general, if you’re calling a coroutine from Update, you’re probably doing it wrong. A coroutine only needs to be started up once, and then it runs until its code is finished - you never need to go back to it from Update.
And coroutines are always called using StartCoroutine.