So Making a gui table and need some help [LUA]

So I have asked Offy about this and he does not really know anything about GUI and so on.

So @JohnFlower I was wondering if you could help me out with it. So what I am trying to do is get the GUI to be not visible when the people press the Done button.

The GUI opens with a command and I want it to close with the Button.

Code Down Below.


Skins = {
      "Cj - 0",
      "",
      ""
}

Vehicle = {
      "",
      ""
}

function setupSkinSelection (theResource)

-- Creats GUI window
spawnScreenMenu = guiCreateWindow ( 0.15, 0.33, 0.7, 0.34, "Find the ID's you want!", true )

-- Button 
spawnScreenOKButton = guiCreateButton ( 0.4, 0.85, 0.20, 0.15, "Done", true, spawnScreenMenu )
      guiWindowSetMovable ( spawnScreenMenu, false )
      guiWindowSetSizable ( spawnScreenMenu, false )
 
 spawnScreenGridList = guiCreateGridList ( 0, 0.1, 1, 0.9, true, spawnScreenMenu )
 guiGridListSetSelectionMode ( spawnScreenGridList, 2 )
 
      guiGridListAddColumn ( spawnScreenGridList, "Skins", 0.3 )
      guiGridListAddColumn ( spawnScreenGridList, "Vehicle", 0.3 )
	  
	        for key,skinName in pairs(Skins) do

            local row = guiGridListAddRow ( spawnScreenGridList )
			
            guiGridListSetItemText ( spawnScreenGridList, row, 1, skinName, false, false )
      end
	  
	  -- Rows for the GUI window
	        row = 0
      for key,skinName in pairs(Vehicle) do
            guiGridListSetItemText ( spawnScreenGridList, row, 2, skinName, false, false )
            row = row + 1
      end
end

-- Command to launch the GUI
addCommandHandler('IDSelection',
	function()
		setupSkinSelection(true)
		showCursor ( true ) 
	end
)

-- Trying to get this to work so it will disappear with the button
addEventHandler ( "onClientGUIClick", spawnScreenOKButton, spawnScreenMenu, false )

Use guiSetVisible in your event handler. You might need a custom function because mta only works half the time.