Is there an efficient way to add stats to your sword

So currently this is in my sword:

image
This is the module script I have which holds a table of data, using serialization. Is this the most efficient way that I can possibly do this. I feel as if there are too many Values inside of a sword, and if a weapon was to have 6-7 upgrades, that would be a lot of changing. If it’s the best way I can possible do it, then I will continue, but if there is a more efficient way, please let me know.

local Weapons = {}

Weapons.WeaponsTable = {
	
	[1] = {
		["Name"] = "Wooden Sword",
		["Owned"] = true,
		["Damage"] = 5,
		["Magic Damage"] = 2,
		["Health"] = 0, 
		["Rarity"] = "Common",
		["Quantity"] = 1
	},
	
	[1.1] = {
		["Name"] = "Wooden Sword",
		["Owned"] = true,
		["Damage"] = 7,
		["Magic Damage"] = 4,
		["Health"] = 0, 
		["Rarity"] = "Common",
		["Quantity"] = 1
	},
	
	[1.2] = {
		["Name"] = "Wooden Sword",
		["Owned"] = false,
		["Damage"] = 10,
		["Magic Damage"] = 5,
		["Health"] = 0, 
		["Rarity"] = "Common",
		["Quantity"] = 0
	},
	
	[1.3] = {
		["Name"] = "Wooden Sword",
		["Owned"] = false,
		["Damage"] = 13,
		["Magic Damage"] = 7,
		["Health"] = 2, 
		["Rarity"] = "Common",
		["Quantity"] = 0
	},
	
	[2] = {
		["Name"] = "Stone Sword",
		["Owned"] = false,
		["Damage"] = 5,
		["Magic Damage"] = 2,
		["Health"] = 0, 
		["Rarity"] = "Common",
		["Quantity"] = 0
	},
	-- [2].. [3].. [4].. and so on.
	
}



return Weapons  

All of this data is handled through a dataStore2 Script Handler. Any help would be appreciate. Thank you :heart:

I think having Value objects is a pretty good way of having stats, since you can change them with ease, whereas if you just have the stats as variables in a script, it can be tough to change the stats.

By having them in a script, I mean having them as variables like this:

local cooldown = 5
local damage = 10
local health = 30
--and so on

If you want to make it more organized, insert a Configuration in the tool, and put the Value objects in it, so you know where they are.

2 Likes

I support the idea of having a Configuration inside the tool!

1 Like

Thank you for you idea, I will use a configuration folder.

What you are currently doing is fine.
You can easily keep everything in one place, which is the goal.

There’s no need for config folders, they just takes up space IMO.
Your solution is already good.

Space? It just helps organize the explorer.

Unnecessary objects. *

That’s your opinion. In MY opinion, it helps organize the explorer, since with one look you can tell what all of the values’ purpose is.

Yes, that is my opinion.
Storing objects just creates unnecessary objects to be downloaded by the server.

I would have everything in a script instead.