How to access all values in a module at once?

Greetings,

It was recently pointed out to me that what I am doing is inefficient but I didn’t get an explanation on how to do it more efficiently. I am hoping someone here can elaborate.

local WeaponValues = {}

WeaponValues.DefaultSword = {
Name = “DefaultSword”,
Damage = 10,
StaminaCost = 5,
BlockingCost = 15,
TimeBetweenAttacks = 1.25,

}

return WeaponValues

Ok so I have a module containing values for each weapon. Then in a server script i define these values according to what weapon is used

----------Weapon Values

local Damage = WeaponValues[Weapon].Damage

local StaminaCost = WeaponValues[Weapon].StaminaCost

local BlockingCost = WeaponValues[Weapon].BlockingCost


How do I access all these values at once? so that I don’t have to redefine them in the server script?

thanks for your time

ok so turns out this is what i was being referred to

return {
[“BanMessages”] = {
[“BanMessage1”] = “Too cool to play this game :)”;
[“BanMessage2”] = “Too bad to play this game :(”;
};
[“ErrorMessages”] = {
[“ErrorMessage1”] = “Error message: 666 Demons entered the game”;
[“ErrorMessage2”] = “Error message: 1337 Too epic to enter the game”;
};
[“ToolPrices”] = {
[“ToolPrice1”] = 333;
[“ToolPrice2”] = 420;
};
}

however i don’t get how this is an improvement?
I still have to do
define each variable separately in the server script?

I don’t get what you mean, no you don’t have to redefine every single variable in the Script. As long as you have it in the ModuleScript you can just require it then you’ve got everything.