you're doing it wrong, i recommend to read this: https://wiki.multitheftauto.com/wiki/Introduction_to_Scripting_the_GUI
function buyweapon(playerSource, commandName)
local buyweapon = guiCreateWindow ( 0.3398, 0.2333, 0.3297, 0.6500, "Weapon Shop", true )
local buyweapondeagle = guiCreateButton ( 0.2915, 0.0369, 0.4242, 0.0641, "Deagle", true, buyWeapon )
local buyweapontec-9 = guiCreateButton ( 0.2938, 0.1058, 0.4265, 0.0609, "Tec-9", true, buyWeapon )
guiSetVisible ( buyweapon, true )
end
addCommandHandler("buyweapons", buyweapon)