hello i have an enemy and when i shoot her or attack her with sword i activate her regdoll and after 2 seconds i want to turn it off again this is my code Code (CSharp): { public bool buul; // Start is called before the first frame update void Start() { Fiziks(true); Colldiers(true); StartCoroutine(WaitBeforeOpen()); buul=false; } // Update is called once per frame void Update() { } void Fizik(bool durum){ Rigidbody[] rg=GetComponentsInChildren<Rigidbody>(); foreach(Rigidbody Fiziks in rg){ Fiziks.isKinematic=durum; } } void Colli(bool durum){ Collider[] cl=GetComponentsInChildren<Collider>(); foreach(Collider Colliders in cl){ Colliders.enabled=durum; } } public void OnCollisionEnter(Collision other){ if(other.gameObject.tag=="Arrow"){ buul=true; GetComponent<Animation>().enabled=false; gameObject.GetComponent<NavMeshAgent>().enabled = false; Fizik(false); Colli(true); } } public IEnumerator WaitBeforeOpen(){ if(buul==true){ yield return new WaitForSeconds(1); GetComponent<Animation>().enabled=true; } buul=false; } }