[HELP] How to strip a player of a weapon, and replace it

Alright, I have no clue what I’m doing here. What i want to happen is when a player buys a crowbar from the shop, it replaces their current melee weapon

What gamemode? Are you using pointshop?

TTT and yes PointShop

You should try using google…



ITEM.Name = 'Sledgehammer' // change this to whatever name you want
ITEM.Price = 600 // change this to whatever price you want
ITEM.Model = 'models/weapons/w_sledgehammer.mdl' // change this to what shop 'icon' you want
ITEM.WeaponClass = 'weapon_zm_sledgehammer' //change this to name for item you want to replace the crowbar with
ITEM.SingleUse = false // makes it persist every time. This does sometimes bug out, a good suggestion would be to add more weapons before this weapon that work similar, may give a workaround to your issue.

function ITEM:OnEquip(ply)
ply:StripWeapon('weapon_zm_improvised')
	ply:Give(self.WeaponClass)
	ply:SelectWeapon(self.WeaponClass)
end

function ITEM:OnHolster(ply)
	ply:StripWeapon(self.WeaponClass)
	ply:Give('weapon_zm_improvised')
	ply:SelectWeapon('weapon_zm_improvised')
end

function ITEM:PlayerSpawn(ply)
        ply:StripWeapon('weapon_zm_improvised')
	ply:Give(self.WeaponClass)
        ply:SelectWeapon(self.WeaponClass)
end