Exit from the car to photon

Hello everyone. In general, in the master anim system project, when the first player leaves the car, everything is fine, and when the second player connects, the first player sits in the air for some reason, and if the first player leaves the second time, everything works fine. What to do? Here's a screenshot: https://ibb.co/C5CzgDw

And here is the master anim system asset itself

https://drive.google.com/file/d/1NCG6XaGTpjgbgf83zmokHRmivz4FxMLO/view?usp=sharing

Maybe something is wrong here? Here is the script:

using UnityEngine;


public class PhotonAction_Car : MonoBehaviour

{

     public Transform PlayerTR;


     private PhotonController CTRL_Script;


     private CharacterController CC;


     private Animator anim;


     private AnimatorStateInfo stateInfo;


     public PhotonDoorInteraction MySit;


     [HideInInspector]

     public float SeatSide;


     [HideInInspector]

     public float SeatID;


     [HideInInspector]

     public bool DoorOpened;


     private PhotonDoorInteraction lastCar;


     public float prkrdtector = 0.4f;


     private Transform CarDetector;


     private Vector3 m_Target = default(Vector3);


     private Vector3 dir;


     private bool InSit;


     private const float m_DoorMatchTargetStart = 0f;


     private const float m_DoorMatchTargetStop = 0.3f;


     private const float m_sitMatchTargetStart = 0.05f;


     private const float m_sitMatchTargetStop = 0.9f;


     private const float m_standMatchTargetStart = 0.05f;


     private const float m_standMatchTargetStop = 0.8f;


     private bool CancelGetOut;


     void Start()

     {

        CTRL_Script = GetComponent<PhotonController>();

        CC = GetComponent<CharacterController>();

        anim = GetComponent<Animator>();

         if (GetComponent<PhotonView>().isMine)

         {

            CarDetector = CTRL_Script.Mcamera.transform;

         }

     }


     void Update()

     {

        ProcessMatchTarget();

        stateInfo = anim.GetCurrentAnimatorStateInfo(0);

         if (stateInfo.IsName("SitInCar") || stateInfo.IsName("CloseDoor_Sitting"))

         {

            GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezePosition;

             if (GetComponent<PhotonView>().isMine)

             {

                CTRL_Script.cam.GetComponent<PhotonCameraRig>().target = MySit.CUC.transform;

                 if (MySit.CUC.speed < 20f && anim.GetFloat("BZWep") == 0f && Input.GetButtonDown("Interact") && MySit)

                 {

                     int viewID = MySit.GetComponent<PhotonView>().viewID;

                     int viewID2 = GetComponent<PhotonView>().viewID;

                    GetComponent<PhotonView>().RPC("PhotonGetOut", PhotonTargets.AllBufferedViaServer, viewID, viewID2);

                 }

             }

            CTRL_Script.InCar = true;

             if (MySit)

             {

                PlayerTR.parent = MySit.StandPos.parent;

             }

            InSit = true;

         }

         else

         {

            GetComponent<Rigidbody>().constraints = RigidbodyConstraints.None;

            CancelCar();

             if (GetComponent<PhotonView>().isMine)

             {

                CTRL_Script.cam.GetComponent<PhotonCameraRig>().target = PlayerTR;

                 if (anim.GetFloat("BZWep") == 0f && Input.GetButtonDown("Interact") && !CTRL_Script.InMenu)

                 {

                    Check4Car();

                 }

             }

            CTRL_Script.InCar = false;

            PlayerTR.parent = null;

            InSit = false;

         }

         if (MySit != null)

         {

            CC.enabled = false;

            MySit.User = base.gameObject;

             if (MySit.AlternateEntrance)

             {

                MySit.AlternateEntrance.User = base.gameObject;

             }

            PlayerTR.rotation = Quaternion.Lerp(PlayerTR.rotation, MySit.StandPos.rotation, 0.1f);

            anim.SetFloat("V_speed", MySit.CUC.speed);

             if (MySit.isBike)

             {

                 if (anim.GetFloat("ForcePosition") != 0f)

                 {

                    GetComponent<PhotonWeaponControl>().CurrentSlot = 0;

                 }

             }

             else if (anim.GetFloat("ForcePosition") != 0f)

             {

                GetComponent<PhotonWeaponControl>().CurrentSlot = 0;

             }

             if (MySit.CUC.TypeID == 0)

             {

                anim.SetFloat("VehicleType", 0f);

             }

             if (MySit.CUC.TypeID == 2)

             {

                anim.SetFloat("VehicleType", 1f);

             }

             if (MySit.CUC.TypeID == 1)

             {

                anim.SetFloat("VehicleType", -1f);

             }

         }

     }


     void Check4Car()

     {

        Ray ray = new Ray(CTRL_Script.ParkourDetector.position, CarDetector.forward);

        RaycastHit hitInfo;

         if (Physics.Raycast(ray, out hitInfo, 2f))

         {

             if (!CTRL_Script.InCover && MySit == null)

             {

                 if (hitInfo.collider.GetComponent<PhotonDoorInteraction>() && hitInfo.collider.GetComponent<PhotonDoorInteraction>().CUC.speed < 1.5f)

                 {

                     int viewID = hitInfo.collider.GetComponent<PhotonView>().viewID;

                     int viewID2 = GetComponent<PhotonView>().viewID;

                    GetComponent<PhotonView>().RPC("PhotonGetIn", PhotonTargets.AllBufferedViaServer, viewID, viewID2);

                 }

             }

             else

             {

                anim.SetBool("Jacking", false);

             }

         }

     }


     [PunRPC]

     void PhotonGetIn(int DoorID, int playerID)

     {

         GameObject gameObject = PhotonView.Find(DoorID).gameObject;

         GameObject gameObject2 = PhotonView.Find(playerID).gameObject;

         if (gameObject.GetComponent<PhotonDoorInteraction>().OpenDirection == Door_Side.Left)

         {

            gameObject2.GetComponent<PhotonAction_Car>().SeatSide = 0f;

         }

         else

         {

            gameObject2.GetComponent<PhotonAction_Car>().SeatSide = 1f;

         }

         if (!gameObject.GetComponent<PhotonDoorInteraction>().User)

         {

            MySit = gameObject.GetComponent<PhotonDoorInteraction>();

            PlayerTR.parent = MySit.StandPos;

            gameObject2.GetComponent<Animator>().SetTrigger("CarFunction");

            gameObject2.GetComponent<Animator>().SetBool("Jacking", false);

         }

         else if (!gameObject.GetComponent<PhotonDoorInteraction>().User != gameObject2)

         {

             gameObject.GetComponent<PhotonDoorInteraction>().User.GetComponent<Animator>().SetTrigger("Jack");

            MySit = gameObject.GetComponent<PhotonDoorInteraction>();

            PlayerTR.parent = MySit.StandPos;

            gameObject2.GetComponent<Animator>().SetTrigger("CarFunction");

            gameObject2.GetComponent<Animator>().SetBool("Jacking", true);

         }

         if (GetComponent<PhotonView>().isMine && gameObject.GetComponent<PhotonDoorInteraction>().isDriver)

         {

             gameObject.GetComponent<PhotonDoorInteraction>().CUC.RequestOwnership();

         }

     }


     [PunRPC]

     void PhotonGetOut(int DoorID, int playerID)

     {

         GameObject gameObject = PhotonView.Find(DoorID).gameObject;

         GameObject gameObject2 = PhotonView.Find(playerID).gameObject;

        CancelCar();

        gameObject2.GetComponent<Animator>().SetTrigger("CarFunction");

         gameObject.GetComponent<PhotonDoorInteraction>().Door_State = Door_Int.Opened;

     }


     void CancelCar()

     {

         if (GetComponent<PhotonView>().isMine && MySit && !CTRL_Script.InCar)

         {

            stateInfo = anim.GetCurrentAnimatorStateInfo(0);

             if (stateInfo.IsName("OpenDoor"))

             {

                 if (MySit.CUC.speed > 1.5f || CTRL_Script.Aim)

                 {

                    anim.SetBool("CancelCar", true);

                    MySit.User = null;

                    MySit = null;

                 }

                 else

                 {

                    anim.SetBool("CancelCar", false);

                 }

             }

             else

             {

                anim.SetBool("CancelCar", false);

             }

         }

     }


     public void GetOut()

     {

         if (MySit.AlternateEntrance)

         {

            MySit.AlternateEntrance.User = null;

         }

        MySit.User = null;

        MySit = null;

     }


     public void OpenDoor()

     {

         if (MySit)

         {

            MySit.Door_State = Door_Int.Opened;

         }

     }


     public void CloseDoor()

     {

        MySit.Door_State = Door_Int.Closed;

     }


     void ProcessMatchTarget()

     {

         if (!anim.IsInTransition(0))

         {

            stateInfo = anim.GetCurrentAnimatorStateInfo(0);

             if (stateInfo.IsName("OpenDoor") && MySit != null)

             {

                 if (MySit.OpenDirection == Door_Side.Left)

                 {

                    anim.MatchTarget(MySit.StandPos.position, default(Quaternion), AvatarTarget.RightFoot, new MatchTargetWeightMask(Vector3.one, 0f), 0f, 0.3f);

                 }

                 else

                 {

                    anim.MatchTarget(MySit.StandPos.position, default(Quaternion), AvatarTarget.LeftFoot, new MatchTargetWeightMask(Vector3.one, 0f), 0f, 0.3f);

                 }

             }

             if (stateInfo.IsName("GetIn 0") && MySit != null)

             {

                lastCar = MySit;

                 if (MySit.OpenDirection == Door_Side.Left)

                 {

                    anim.MatchTarget(MySit.SitPos.position, default(Quaternion), AvatarTarget.RightFoot, new MatchTargetWeightMask(Vector3.one, 0f), 0.05f, 0.9f);

                 }

                 else

                 {

                    anim.MatchTarget(MySit.SitPos.position, default(Quaternion), AvatarTarget.LeftFoot, new MatchTargetWeightMask(Vector3.one, 0f), 0.05f, 0.9f);

                 }

             }

             if (stateInfo.IsName("GetOut 0") && lastCar.CUC.TypeID != 2)

             {

                 if (lastCar.OpenDirection == Door_Side.Left)

                 {

                    anim.MatchTarget(lastCar.StandPos.position, default(Quaternion), AvatarTarget.RightFoot, new MatchTargetWeightMask(Vector3.one, 0f), 0.05f, 0.8f);

                 }

                 else

                 {

                    anim.MatchTarget(lastCar.StandPos.position, default(Quaternion), AvatarTarget.LeftFoot, new MatchTargetWeightMask(Vector3.one, 0f), 0.05f, 0.8f);

                 }

             }

         }

     }

}