for i=1,5000 do local en=ents.GetByIndex(i) if en:IsValid() then if en:GetParent()==ply then if en:IsWeapon() then -- this weapon belongs to the player end end end end