Try this:
local skinmsglabel = "Welcome"
..
Sgrid = guiCreateGridList(12,59,345,439,false,Window)
...
Buttonbuyskin = guiCreateButton(12,503,122,29,"Buy skin (350$)",false,Window)
Buttonclose = guiCreateButton(240,503,117,30,"Exit",false,Window)
LabelTNS = guiCreateLabel(50,36,220,30,skinmsglabel ,false,Window)
...
addEventHandler("onClientGUIClick", root,
function ()
if (source == Buttonbuyskin) then
local row,col = guiGridListGetSelectedItem(Sgrid)
if (row and col and row ~= -1 and col ~= -1) then
local finalskin = guiGridListGetItemText(Sgrid, row, 1 )
triggerServerEvent ( "buySkin", localPlayer, tonumber ( finalskin ) )
else
if isTimer ( timer ) then
killTimer ( timer )
end
guiSetText ( LabelTNS, "Error: Please select a skin from the list." )
timer = setTimer ( guiSetText, 3000, 1, LabelTNS, skinmsglabel )
end
end
end
)