WeaponSelect doesnt select it "really"

WeaponSelect doesnt select it “really”.
I’m using this Code.

SERVERSIDE CODE.



hook.Add("PlayerCanPickupWeapon","DisableNaturalyPickuping",function( ply, wep )
	if wep.IsInventory then return true end
	return false
end)
hook.Add("PlayerSwitchWeapon","SelectOnlyWithInventory",function( ply, oldWep,newWep )
	if newWep:GetClass() == "srust_build" then return true end
	if newWep:GetClass() == "weapon_physgun" then return true end
	local r = (ply.InventoryNewSlot or false)
	ply.InventoryNewSlot = false
	return r
end)

local metaTable = FindMetaTable("Player")
function metaTable:GiveInventory(cls) // Allows Picking up the Weapon
	local e = ents.Create(cls)
	e.IsInventory = true
	e:SetPos(self:GetPos())
	e:Spawn()
	e:Activate()
	self:SetActiveWeapon(self:GetWeapon(cls))
end
function metaTable:HotBarEvent()
	if self.HotBarIndex then else self.HotBarIndex = 0 end
	if (self.coffeeInventory && self.coffeeInventory[1][self.HotBarIndex+1] != false) then
		self.selectedItemNew = self.coffeeInventory[1][self.HotBarIndex+1]
	else
		self.selectedItemNew = {}
	end
	if not self.selectedItemOld then self.selectedItemOld = {} end
	if self.selectedItem == self.selectedItemNew then return end
	
	local FruitEntities = {"fs_apple","fs_banana","fs_cabbage","fs_lemon","fs_melon","fs_orange","fs_potato","fs_tomato","fs_watermelon"}
	local SeedEntities = {"0seed_apple","0seed_banana","0seed_cabbage","0seed_lemon","0seed_melon","0seed_orange","0seed_potato","0seed_tomato","0seed_watermelon"}
	local BuildFreeEntities = {"rust_campfire"}
	
	local Hand = "rust_handz"
	local BuiltFreeSWEP = "rust_handz"
	local FruitSWEP = "rust_eat_fruit"
	local SeedSWEP = "rust_place_seed"
	local InventorySWEPs = {"rust_stonepickaxe","rust_ironpickaxe","rust_copperpickaxe","rust_stonehatchet","rust_ironhatchet","rust_copperhatchet","weapon_physgun"}
	
	if (self.coffeeInventory && self.coffeeInventory[1][self.HotBarIndex+1] != false) then
		self.selectedItem = self.coffeeInventory[1][self.HotBarIndex+1]
		if self:HasWeapon(Hand) then self:GetWeapon(Hand):Remove() end
		
		/* FRUITS START */
		if table.HasValue(FruitEntities,self.selectedItem.class) then
			self:GiveInventory(FruitSWEP)
			self:GiveInventory(FruitSWEP)
			self:SetNWString("FruitSWEP.Fruit",self.selectedItem.class)
			self:SetNWString("FruitSWEP.Model",self.selectedItem.mdl)
		else
			if self:HasWeapon(FruitSWEP) then self:GetWeapon(FruitSWEP):Remove() end
		end
		/* FRUITS STOP */
		/* SEEDS START */
		if table.HasValue(SeedEntities,self.selectedItem.class) then
			self:GiveInventory(SeedSWEP)
			self:GiveInventory(SeedSWEP)
			self:SetNWString("SeedSWEP.Class",self.selectedItem.class)
		else
			if self:HasWeapon(SeedSWEP) then self:GetWeapon(SeedSWEP):Remove() end
		end
		/* SEED STOP */
		if table.HasValue(BuildFreeEntities,self.selectedItem.class) then
			self:GiveInventory(BuiltFreeSWEP)
			self:GiveInventory(BuiltFreeSWEP)
			self:SetNWString("BuiltFreeSWEP.Class",self.selectedItem.class)
		else
			if self:HasWeapon(FruitSWEP) then self:GetWeapon(FruitSWEP):Remove() end
		end
		for i,k in pairs(InventorySWEPs) do
			if self:HasWeapon(k) then self:GetWeapon(k):Remove() end
		end
		if table.HasValue(InventorySWEPs,self.selectedItem.class) then
			self:GiveInventory(self.selectedItem.class)
			self:GiveInventory(self.selectedItem.class)
		end
	else
		self:StripWeapons()
		self:GiveInventory(Hand)
		self:SelectWeapon(Hand)
		self.selectedItem = {}
	end
	self.selectedItemOld = self.selectedItem
end


Anyway if i select an Inventory Item from the Hotbar it shows me this “Picked Up a Weapon” hint on the right side but it doesnt select them so i can use it!
mightbe an bug