Creating the game's items and the inventory. Need help!

Does anyone know how to create a script that lists all the items in game and their attributes, such as the item’s damage, and the model that represents it? Then how would I script an inventory GUI for the player that can store those items? Here is the script I came up with but I seriously doubt it would work:
Click Here

Ps, there is a reason for all the inventory slots being variables. For me it makes it easier to use with the inventory save function here:
[Click Here][2]

If there are any changes and things I need to do get the inventory to work and to get items in the game that you know about, please tell me. Thanks
[2]: PlayCanvas | HTML5 Game Engine