Help with my inventory system

hello there, i was wondering if anyone could help me with my inventory system. I have created an open/close button, which opens a box, with 30 buttons inside to hold the items.
Where do i go from here?

My code:

import System.Collections.Generic;

var buttonText = "Open";
var buttonOpen : boolean = true;
var openGUI : boolean = false;
var playerInventory : List.<ItemClass> = new List.<ItemClass>();
var button1;
var AddItem : AddItem;

function Start () {

}


function OnGUI() {
    if(GUI.Button(new Rect(20,20,80,30),buttonText))
    {
    if(buttonText == "Open")
    {
	buttonText = "Close";
    } 
    else 
    	buttonText = "Open";
    }
    if(buttonText == "Close")
    {
    	openGUI = true;
        GUI.Box(Rect(Screen.width/2-300, Screen.height/2-250, 600, 500), "Inventory");
 		//top row
        GUI.Button(Rect(Screen.width/2-275, Screen.height/2-200, 50, 50), playerInventory[x].icon); x++;
        GUI.Button(Rect(Screen.width/2-175, Screen.height/2-200, 50, 50), playerInventory[x].icon); x++;
        GUI.Button(Rect(Screen.width/2-75, Screen.height/2-200, 50, 50), playerInventory[x].icon); x++;
        GUI.Button(Rect(Screen.width/2+25, Screen.height/2-200, 50, 50), playerInventory[x].icon); x++;
        GUI.Button(Rect(Screen.width/2+125, Screen.height/2-200, 50, 50), playerInventory[x].icon); x++;
        GUI.Button(Rect(Screen.width/2+225, Screen.height/2-200, 50, 50), playerInventory[x].icon); x++;
        //second row
        GUI.Button(Rect(Screen.width/2-275, Screen.height/2-110, 50, 50), playerInventory[x].icon); x++;
        GUI.Button(Rect(Screen.width/2-175, Screen.height/2-110, 50, 50), playerInventory[x].icon); x++;;
        GUI.Button(Rect(Screen.width/2-75, Screen.height/2-110, 50, 50), playerInventory[x].icon); x++;
        GUI.Button(Rect(Screen.width/2+25, Screen.height/2-110, 50, 50), playerInventory[x].icon); x++;
        GUI.Button(Rect(Screen.width/2+125, Screen.height/2-110, 50, 50), playerInventory[x].icon); x++;
        GUI.Button(Rect(Screen.width/2+225, Screen.height/2-110, 50, 50), playerInventory[x].icon); x++;
        //third row
        GUI.Button(Rect(Screen.width/2-275, Screen.height/2-10, 50, 50), playerInventory[x].icon); x++;
        GUI.Button(Rect(Screen.width/2-175, Screen.height/2-10, 50, 50), playerInventory[x].icon); x++;
        GUI.Button(Rect(Screen.width/2-75, Screen.height/2-10, 50, 50), "15");
        GUI.Button(Rect(Screen.width/2+25, Screen.height/2-10, 50, 50), "16");
        GUI.Button(Rect(Screen.width/2+125, Screen.height/2-10, 50, 50), "17");
        GUI.Button(Rect(Screen.width/2+225, Screen.height/2-10, 50, 50), "18");
        //fourth row
        GUI.Button(Rect(Screen.width/2-275, Screen.height/2+90, 50, 50), "19");
        GUI.Button(Rect(Screen.width/2-175, Screen.height/2+90, 50, 50), "20");
        GUI.Button(Rect(Screen.width/2-75, Screen.height/2+90, 50, 50), "21");
        GUI.Button(Rect(Screen.width/2+25, Screen.height/2+90, 50, 50), "22");
        GUI.Button(Rect(Screen.width/2+125, Screen.height/2+90, 50, 50), "23");
        GUI.Button(Rect(Screen.width/2+225, Screen.height/2+90, 50, 50), "24");
        //fourth row
        GUI.Button(Rect(Screen.width/2-275, Screen.height/2+190, 50, 50), "25");
        GUI.Button(Rect(Screen.width/2-175, Screen.height/2+190, 50, 50), "26");
        GUI.Button(Rect(Screen.width/2-75, Screen.height/2+190, 50, 50), "27");
        GUI.Button(Rect(Screen.width/2+25, Screen.height/2+190, 50, 50), "28");
        GUI.Button(Rect(Screen.width/2+125, Screen.height/2+190, 50, 50), "29");
        GUI.Button(Rect(Screen.width/2+225, Screen.height/2+190, 50, 50), "30");
    }}
    else
    {
    	openGUI = true;
    }
 if(x == 30) 
 {
  AddItem.canLoot = false;
 }

If I were you, I would write it like this (top row):

for(var i: int = 0; i < 6; i++) {

GUI.Button(Rect(Screen.width/2-275 + (i * 100), Screen.height/2-200, 50, 50), playerInventory[x].icon); x++;

}

Building off of Magnomous’s idea you can apply it to the entire grid of buttons assuming you want them all spaced evenly:

//So we don't have to re-calculate this every button
	var centerWidth = Screen.width / 2;
	var centerHeight = Screen.height / 2;
	
	var x = 0;
	
	for(var column = -275; column <= 225; column+=100){//we want a new column every 100 units
		for(var row = -200; row <= 200; row+=100){//we want a new row every 100 units (it looks like you did 90 for the first, then 100 for all else)
			if(x < 15)//use player icon
				GUI.Button(Rect(centerWidth + column, centerHeight + row, 50, 50), playerInventory[x].icon); 
			else//use string showing number for button
				GUI.Button(Rect(centerWidth + column, centerHeight + row, 50, 50), x.ToString());
			x++;	
		}	
	}