point shop help

Ok so i have a point shop where you can buy the attachments, this is the code for one of the attachments,


ITEM.Name = 'PSO-1 (Sight)'
ITEM.Price = 5000
ITEM.Model = 'models/Items/BoxMRounds.mdl'
ITEM.WeaponClass = 'fas2_att_pso1'
ITEM.SingleUse = false


function ITEM:CanPlayerBuy(ply)
    return ply:Alive()
	return ply:give(self.WeaponClass)
end

function ITEM:OnHolster(ply)
	ply:StripWeapon(self.WeaponClass)
end

What it does is it spawns the attachment box like 1 inch below the ground so when i press “e” to pick it up it rarly happens as its below the ground.

What i want to happen is they buy it gets added to there inventory or equipts it so they dont need to hit “e” ant ideas?

This code shouldn’t work at all; you can only return one thing in a function. Also, “Give” should be capitalized. Try this:


ITEM.Name = 'PSO-1 (Sight)'
ITEM.Price = 5000
ITEM.Model = 'models/Items/BoxMRounds.mdl'
ITEM.WeaponClass = 'fas2_att_pso1'
ITEM.SingleUse = false


function ITEM:OnEquip(ply)
   ply:Give(self.WeaponClass)
end

function ITEM:OnHolster(ply)
   ply:StripWeapon(self.WeaponClass)
end

thanks code_gs you fixed it!