Remove weapon on drop/death

Lua noob here! Is there any sort of function or code that will remove a players weapon on death or drop that I could simply copy and paste into the shared.lua of the weapon. Any help is greatly appreciated :slight_smile:

This should be your solution


SWEP.AllowDrop = false

function SWEP:OnDrop()
	self:Remove()
end

Edited: Cleared it up for you

function SWEP:OnDrop()
self:Remove()

How would this work?
And also, to go slightly off topic, how do you get the grey box for the code? (for future reference :slight_smile: )

Basically, it says: " If the weapon is dropped, remove the weapon "

Edited: Thatโ€™s piece of cake, just wrap your code in code tags. Like when you quote, instead just write CODE and /CODE in the .