My "if" is not working and have no idea why

First of all I want to thank you guys. Reading the answers of the other questions, made a lot of things clear to me.

This is my problem:

I’m working on a 2D asteroid like game. There is a spaceship and it has a package connected (i’m using SringJoint2D to that).

When the player press “space” the package is disconnected:

if(Input.GetKeyDown(KeyCode.Space))
{	
    //SpringJoint2D
	sj2d.enabled=false;
	//this is just a bool variable to "record" if it's free
	estaSolta=true;
}

There are two kinds of triggers that the package can collide. The right one (the package destiny) and the wrong one (the rest).
When the package collides, it’s supposed to show up a GUI menu. And this is the code i’m using to that:

void OnTriggerEnter2D(Collider2D col)
	{
		//if it collides with the right trigger
		if(col.gameObject.tag=="destino")
		{
			if (estaSolta == true)
			{
				Time.timeScale=0f;
				menuVitoria = true;
			}
		}
		//if it collides with the wrong trigger
		else
	 {
		if (estaSolta == true)
		{
			Instantiate(explosao,transform.position, new Quaternion());
			gameObject.SetActive(false);
			menuDerrota=true;
			Time.timeScale=0f;

		}
	}
	}

void OnGUI()
{
	//if it collides with the wrong trigger
	if(menuDerrota)
	{
		//this is just an if to verify if the player selected Portuguese in the language menu
		if(PlayerPrefs.GetInt("lingua")==1?true:false)
		{
			GUI.BeginGroup(new Rect(Screen.width/10, Screen.height/10, 400, 300));
			GUI.Box(new Rect(0, 0, 400, 400), "Perdeu!!");
			Screen.showCursor=true;
			GUI.EndGroup();
		}
		//if it is in English
		else
		{
			GUI.BeginGroup(new Rect(Screen.width/10, Screen.height/10, 400, 250));
			GUI.Box(new Rect(0, 0, 400, 400), "You've lost");
			Screen.showCursor=true;
			GUI.EndGroup();
		}
		
	}
	//if it collides with the right trigger
	if(menuVitoria)
	{
		if(PlayerPrefs.GetInt("lingua")==1?true:false)
		{
			GUI.BeginGroup(new Rect(Screen.width/10, Screen.height/10, 400, 300));
			GUI.Box(new Rect(0, 0, 400, 400), 
			        "Meus parabens, voce conseseguiu fazer a entrega no prazo");
			Screen.showCursor=true;
			GUI.EndGroup();
		}
		else
		{
			GUI.BeginGroup(new Rect(Screen.width/10, Screen.height/10, 400, 250));
			GUI.Box(new Rect(0, 0, 400, 400), 
			        "Congratulations, you delivered on time");
			Screen.showCursor=true;
			GUI.EndGroup();
		}
		
	}
}

What is happening:
When the package collides with the right trigger, the game freezes and the GUI menu appears but when the package collides with any other thing the game freezes, the bool variable menuDerrota becomes true but the GUI menu doesn’t appear

In your

if (estaSolta == true) 

you are disabling the current game object by setting

gameObject.SetActive(false);

So once the game object is disabled none of the script attached to that game object will execute hence your remaining script is not executing and no GUI is shown.

One workaround will be to keep all your OnGUI code in a separate file on another game object and then even if you disable the current game object you can still show the GUI.

Also make sure you set your gameObject.SetActive(false) at the end of your else.