Selection grid not working?

In the following code, it always prints 0 while I set it to 1, even when I press one of the buttons it does not change. Whats wrong with my code?

var SelectedMPLevel 				:int = 1;
var MpLevelImages					:Texture2D[];
var colums :int = 3;
	
function OnGui()
{
	GUI.SelectionGrid(Rect(156, 250, 700, 400), SelectedMPLevel, MpLevelImages, colums);
	print(SelectedMPLevel);
}

Try :

SelectedMPLevel = GUI.SelectionGrid(Rect(156, 250, 700, 400), SelectedMPLevel, MpLevelImages, colums);

It reevaluates every frame the var SelectedMPLevel to your selection.