How to apply json file variables to player variables(Im new)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Iplayx

So I have this as an example:
{
“10001”: {
“Name”: “Old Sword”,
“Category”: “Weapon”,
“Type”: “Sword”,
“EquipmentSlot”: “Hand”,
“Attack”: 20,
“Defense”: null,
}

How can I make the attack of my weapon add to my player attack when equip.

:bust_in_silhouette: Reply From: jgodfrey

Are you just asking how you can access that Attack value? If so, assuming you have something like:

var props = {
"10001": {
"Name": "Old Sword",
"Category": "Weapon",
"Type": "Sword",
"EquipmentSlot": "Hand",
"Attack": 20,
"Defense": null,
}}

You can access that Attack value (20) like:

var attack_val = props["10001"]["Attack"]

Then, you can do whatever you want with that value.