VR: Put item in hand from List

Hey guys, I hope you are doing well.

So I am creating a VR with XR game in which I have a list of items as Scriptable Objects. Now I want to put one item in my hand when I press a button but I run into problems because my function is not doing the right thing. This is how it looks like:

public void PutItemInHand()
{
    for (int i = 0; i < inventoryItems.Count; i++)
    {
        if (inventoryItems*.name == "Sword")*

{
Instantiate(inventoryItems*, handSpawn.position, handSpawn.rotation);*
}
else if (inventoryItems*.name == “Gun”)*
{
Instantiate(inventoryItems*, handSpawn.position, handSpawn.rotation);*
}
}
}
Also it says: “Cannot instantiate a ScriptableObject with a position and rotation”.
Do you guys have an idea? I would be grateful for any help.
Kind regards

I’ve only begun to play around with ScriptableObjects, but as far as I can tell they’re basically a parent class. So hopefully you’ve set your objects to be children, and aren’t using only the parent class. But one error I can see already, is you haven’t defined a parent. So you’d make the object, but it’d stay where ever it spawned. You might wanna declare the hand the parent(if it’s separate object?) or declare the object so you can reference it later:

public GameObject rightHandObj;


void SpawnInRightHand()
{
    rightHandObj = Instantiate(List*, handPos, handRot, parentObject);*

// or no parent if coding it’s values
}

void HoldRightHand()
{
rightHandObj.SetPositionAndRotation(handPos, handRot);
}
^or something like that