NPC HELP / INVERTORY

Hi I am new to all this I got a NPC gundealer scripted got it all running but when I buy a Iteam it will go to hand/scroll menu is they a way to send the bought Iteam to my invertory instead allowing safe buys so they player wont lose it untill its taken out of invertory here is the code I used

buy_var = net.ReadDouble()
if gunDealerConfig[buy_var][5] == nil then
if ( ply:canAfford( gunDealerConfig[buy_var][2] ) ) then
ply:Give( gunDealerConfig[buy_var][3] )
ply:addMoney(-gunDealerConfig[buy_var][2])
net.Start( “gundealer_confirmedtext” )
net.Send( ply )
return
end
end
for m, n in pairs( gunDealerConfig[buy_var][5] ) do
if team.GetName(ply:Team() ) == n then
if ( ply:canAfford( gunDealerConfig[buy_var][2] ) ) then
ply:Give( gunDealerConfig[buy_var][3] )
ply:addMoney(-gunDealerConfig[buy_var][2])
net.Start( “gundealer_confirmedtext” )
net.Send( ply )
return
end
end