Your code is using the legacy particle system, which was marked obsolete over 3 years ago, and was finally removed from Unity in phases during the 2018.x cycle. You’ll either have to replace with the current particle system, or go back to a version of Unity prior to its removal, such as 2017.x or earlier to use this old code.