Hey everyone. I’m currently trying to do something that should be possible, but I can’t figure out how to do it. Basically I want players to spawn with the crowbar like normal, but if they buy a new melee weapon in the pointshop (by _Undefined) I want it to strip the player of his melee weapon and give him the new weapon in return permanently. I then want the player to be able to holster it and have it go back to the default crowbar. It sounds simple enough but whenever I get a new melee weapon it completely overrides the crowbar meaning I can’t give it to them as the default weapon. I also can’t get it to switch their weapons in the pointshop. Whenever they go to buy a new one it just leaves them with the same melee weapon. I got a bit of code working to switch it back to the crowbar, but it only works for one round, when the player dies they don’t have the crowbar. I’m guessing if I can figure out why it is being overridden then I can get it all working properly.
This is the code that switched the overridden weapon with the crowbar.
function ITEM:OnEquip(ply) ply:StripWeapon('weapon_zm_improvised') -- Remove this if you're not replacing the melee weap ply:Give(self.WeaponClass) ply:SelectWeapon(self.WeaponClass) end function ITEM:OnHolster(ply) ply:StripWeapon(self.WeaponClass) ply:Give('weapon_zm_improvised') -- Remove this if you're not replacing the melee weap ply:SelectWeapon('weapon_zm_improvised') -- Remove this if you're not replacing the melee weap end
So, if someone could tell me what is overriding the crowbar, or how to switch melee weapons in TTT I’d really appreciate it. Thankyou