Having Touble getting a raycast to ignore destroying an object.

So, I have a sandbox game that I’ve been working on, where you can place cubes and a few other shapes to create vehicles to drive around and fight other players with, but inside the vehicle creation, I have a floor that is made up of a bunch of colliders so that you can place the blocks on them in a grid like pattern. The issue I’m having is when I start the game I am actually able to delete these blocks too when I right click on them, which is not what I want. Is there a way to set a flag so that the Raycast will detect them when I’m left clicking but ignore them when I right click?

Here’s my code that does the creating/destroying of the blocks.

var Cube : Transform;
    var Inner : Transform;
    var Prism : Transform;
    var Tetra : Transform;
    var Tire1 : Transform;
    var CockPit1 : Transform;
    var Thruster1 : Transform;
    
    var BlockSelected : float = 1;
    
    var Range : float = 20;
    
    function Update () 
    {
    	// Q + E Controls (Temporary, Waiting for Better Implimentation)
    	if(Input.GetKeyDown(KeyCode.Q))
    	{
    		BlockSelected -= 1;
    	}
    	
    	if(Input.GetKeyDown(KeyCode.E))
    	{
    		BlockSelected += 1;
    	}
    	
    	
    	//Mouse Controls
    	if(Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
    	{
    		var Hit : RaycastHit;
    		var LookingDirection = transform.TransformDirection(Vector3.forward);
    		
    		if(Physics.Raycast(transform.position, LookingDirection, Hit, Range))
    		{
    			if(Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(0))
    			{
    				
    				//Block Placement
    				if(BlockSelected == 1)
    				{
    					var Cube : Transform = Instantiate(Cube, Hit.collider.transform.position + Hit.normal.normalized, Quaternion.identity);
    					Cube.tag = "Cube";
    				}
    				
    				if(BlockSelected == 2)
    				{
    					var Inner : Transform = Instantiate(Inner, Hit.collider.transform.position + Hit.normal.normalized, Quaternion.identity);
    					Inner.tag = "Inner";
    				}
    				
    				if(BlockSelected == 3)
    				{
    					var Prism : Transform = Instantiate(Prism, Hit.collider.transform.position + Hit.normal.normalized, Quaternion.identity);
    					Prism.tag = "Prism";
    				}
    				
    				if(BlockSelected == 4)
    				{
    					var Tetra : Transform = Instantiate(Tetra, Hit.collider.transform.position + Hit.normal.normalized, Quaternion.identity);
    					Tetra.tag = "Tetra";
    				}
    				
    				if(BlockSelected == 5)
    				{
    					var Tire1 : Transform = Instantiate(Tire1, Hit.collider.transform.position + Hit.normal.normalized, Quaternion.identity);
    					Tire1.tag = "Tire1";
    				}
    				
    				if(BlockSelected == 6)
    				{
    					var CockPit1 : Transform = Instantiate(CockPit1, Hit.collider.transform.position + Hit.normal.normalized, Quaternion.identity);
    					CockPit1.tag = "CockPit1";
    				}
    				
    				if(BlockSelected == 7)
    				{
    					var Thruster1 : Transform = Instantiate(Thruster1, Hit.collider.transform.position + Hit.normal.normalized, Quaternion.identity);
    					Thruster1.tag = "Thruster1";
    				}
    			}
    			
    			else
    				{
    					Destroy(Hit.transform.gameObject);
    				}
    		}
    	}
    }

Could someone please help me out? It would be very appreciated.

Hello @EscTheCtrl ,

just replace this

 if(Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))

with this line.

if(Input.GetMouseButtonDown(0))

here is the documentation of GetMouseButtonDown.
Input.GetMouseButtonDown(1) is use for right click.
hope this helps you.