Hello, I want to remove the following floating object when the player, switches to a weapon, and I was wondering how I could do this.
The code I am trying to use, does not work.
hook.Add( "KeyPress", "RemoveEntity", function( ply, key ) if ( ply:GetActiveWeapon():GetClass() == "weapon_sh_tool" ) then if(key == KEY_1 or key == KEY_2 or key == KEY_3 or key == KEY_4)then ents.FindByName("GhostEntity"):Remove() end end end )
I am using this script to control switching weapons: http://forum.facepunch.com/showthread.php?t=1484243
[editline]4th September 2015[/editline]
Anyone got an idea?