Entering and exiting vehicles in Photon Cloud

Hi, basically i want to be able to enter/ exit my jet i made in photon cloud, currently you can but only on player can be in the vehicle.

Here is the current code:

using UnityEngine;
using System.Collections;

public class Jet_Entre : MonoBehaviour {
	
	public GameObject Player;
	public Jet_Network Jetwork;
	public Jet jet;
	public Jet_Cam Cam;
	public bool CanEnter = false;
	
	
	void Start(){
	
	}
	
	void OnTriggerEnter(Collider other){
		if(other.gameObject.tag == "Player"){
			Player = other.gameObject;
			CanEnter = true;
			
		}	
	}
	
	
		
		
		
	
	
	// Use this for initialization

	
	void OnTriggerExit(Collider other){
		Player = null;	
		CanEnter = false;
	}
	
	// Update is called once per frame
	void Update () {
		
			
			if(Input.GetKeyDown(KeyCode.F)&& CanEnter == true){
				Jetwork.enabled = true;
				Player.SetActiveRecursively(false);
				Player.transform.parent = gameObject.transform;
		//		jet.enabled = true;
				Cam.enabled = true;
			

				
			}
			if(Input.GetKeyDown(KeyCode.R)){
				Player.transform.localPosition = new Vector3(0,3,0);
				jet.enabled = false;
				Cam.enabled = false;
				Jetwork.enabled = false;
				Player.SetActiveRecursively(true);
				Player.transform.parent = null;
				Player.transform.rotation = new Quaternion(0,90,0,0);
				
				
			}
	}
}

Can someone help me make it so more than one person can be in the jets.
Thanks :slight_smile:

You need a variable to store player1 and player 2 otherwise the references are reassigned. You can create an array of players too.

public GameObject Player1;
public GameObject Player2;
public bool Player1CanEnter = false;
public bool Player2CanEnter = false;

if(other.gameObject.tag == "Player1"){
         Player1 = other.gameObject;
         Player1CanEnter = true;
}
else if (othere.gameObject.tag == "Player2"){
         Player2 = other.gameObject;
         Player2CanEnter = true;
}