Hello Developers!
In my player data table I keep references to the knife/gun models.
export type PlayerData = {
Inventory: {
Knifes: {[number]:
{
["Model"] : string,
}
},
Guns: {[number]:
{
["Model"] : string,
}
},
},
EquippedKnife: string,
EquippedGun: string,
}
local DEFAULT_PLAYER_DATA: PlayerData = {
Inventory = {
Knifes = {
[1] = {
["Model"] = "Default",
},
[2] = {
["Model"] = "Formosa",
}
},
Guns = {
[1] = {
["Model"] = "DefaultGun",
},
},
},
EquippedKnife = "Default",
EquippedGun = "DefaultGun",
}
In the future I want players to be able to have multiple items of the same knife/gun, for example having x10 Formosa knives. As well as including a trading system. I also want to keep track of each item that is currently circulating in game.
My issue is that I do not know the best way to structure the player’s data.
I have thought about using UUID for the use of trading, tracking each individual knife/gun but It also seems to be quite expensive to do? Storing it in a table as such. With using UUID I also don’t really know how to structure the data to allow stacks of the same item,
For reference, I also have a server module script that stores all “data” of the knives and guns for it to be easily maintained and alter.
local ItemDataTable: {[string]:ItemConfig.ItemData} = {
Default = {
Name = "Default",
Type = "Knife",
Rarity = "Common",
Tradable = false
},
Sycth = {
Name = "Sycth",
Type = "Knife",
Rarity = "Divine",
Tradable = true
},
Formosa = {
Name = "Formosa",
Type = "Knife",
Rarity = "Divine",
Tradable = true
},
DefaultGun = {
Name = "Default",
Type = "Gun",
Rarity = "Common",
Tradable = false
}
}
I am just very conflicted on how to structure all of this.
I appreciate any form of help
Thank you!