Definitely first one. I would format it like this though, with the start of the function on the same line. It's the common way of writing it because you'll have less indentation.
addEventHandler("onClientGUIClick", window, function(button, state)
if button ~= "left" then return end
if source == btnClose then
return closeMenu()
end
if source == btnChange then
local AmountKey = guiGetText(EditKey)
if AmountKey == "" then
return outputChatBox("error", 255, 25, 25, true)
end
if string.len(AmountKey) ~= 16 then
return outputChatBox("error", 255, 25, 25, true)
end
outputChatBox("successful", 255,126,0, true)
closeMenu()
end
end)
Good luck!