Making A Universal Pickup Script

Hello Everyone, Right now i am working on a game that has 100 weapons/items that can be picked up my question is if there is a way to assign a variable in the inspector (like savescript.weapon1 = 1) but have is so that i can change what variable is being changed without making 100 different scripts, if anyone has an answer or know where i can find one that would be greatly appreciated!

I think I know what you’re trying to do here. Attach this script to the pickup item.

var itemCode = 1; //This tells us which item this pickup is
var saveState : //Replace this comment with the name of the save state script

function OnTriggerEnter (col : Collider) {
    if(col.gameObject.tag == "Player") { //This lets us see that the collider we hit is the player
        saveState.weapon1 = itemCode; //Sets the save state to this weapon we picked up
        GameObject.Destroy(gameObject); //Gets rid of the pickup

This script is in JavaScript. Which means that You’ll have to do some modifications if get it to work with a C# Save State