Errors from Random Loot Script Calls

I'm having two errors while using random loot script calls, and I'm honestly not sure what's going on. I didn't come up with the script call itself, but it seemed to be working fine at first, then this started happening sometimes.

With the first error, the text box for the item comes up, but it doesn't actually add the item to your inventory. And with the first error, I then can't do anything else.

Any advice would be appreciated.
I'm pretty sure the command is gainItem and not gainItems.
Remove the s and try again.
Hey,

unfortunately I can't help with the "name of null" error, but you misspelled the script call for adding Items. It's
$gameParty.gainItem($dataWeapons[$gameVariables.value(1)], +1); not
$gameParty.gainItems($dataWeapons[$gameVariables.value(1)], +1); (notice the s in ItemS)
Maybe correcting this may get rid of the second error? ☺️
Ah, I hadn't noticed that. Thank you guys very much, that's fixed that issue. And I think I've fixed the second issue, I was doing something wrong with the variables, I think.

Thanks again.

Original thread: https://forums.rpgmakerweb.com/threads/errors-from-random-loot-script-calls.78910/