npc to drop specific weapons

im trying to make a list of weapons witch where npcs would drop from this list.

if not SERVER then return end

local WeaponList = {

hook.Add(“OnNPCKilled”, “DropWeaponOnNPCKilled”, function(npc, killer, weapon)

local weapon = ents.Create(table.Random(WeaponList)) --randomly choose a weapon entity from WeaponList
weapon:SetPos(npc:LocalToWorld(npc:OBBCenter())) -- Set the position to the center of the NPC


like so would this work? i tried but i cant seem to get it.

you can just get the position of the npc by doing local pos = npc:GetPos(), then instead of doing

you can do

weapon:SetPos( pos.x, pos.y, pos.z + 50 )

oh hmm ill try that cus npcs drop these weapons i put in the list but also drop other weapons like smg and idk y…