I made a dictionary that stores all the player’s data through IDs and then gathers the data of the items through a Database (ModuleScripts, folders, etc.) in ServerStorage (models for swords, images, stats, etc.) and I realized that it feels kind of inefficient and long. Here’s a look at the dictionary:
local plrTable = { -- get data from database through IDs
["itemInventory"] = {
["slot01"] = {
["ID"] = nil},
["slot02"] = {
["ID"] = nil},
["slot03"] = {
["ID"] = nil},
["slot04"] = {
["ID"] = nil},
["slot05"] = {
["ID"] = nil},
["slot06"] = {
["ID"] = nil},
["slot07"] = {
["ID"] = nil},
["slot08"] = {
["ID"] = nil},
["slot09"] = {
["ID"] = nil},
["slot10"] = {
["ID"] = nil},
["slot11"] = {
["ID"] = nil},
["slot12"] = {
["ID"] = nil},
["slot13"] = {
["ID"] = nil},
["slot14"] = {
["ID"] = nil},
["slot15"] = {
["ID"] = nil},
["slot16"] = {
["ID"] = nil},
["slot17"] = {
["ID"] = nil},
["slot18"] = {
["ID"] = nil},
},
["defenseInventory"] = {
["hat"] = {
["ID"] = nil},
["torso"] = {
["ID"] = nil},
["leggings"] = {
["ID"] = nil},
["sword"] = {
["ID"] = nil}
},
["currencyValue"] = {
["Gold"] = 0,
["Gems"] = 0,
["XP"] = 0
},
["powerCards"] = {
["slot01"] = {
["ID"] = nil},
["slot02"] = {
["ID"] = nil},
["slot03"] = {
["ID"] = nil},
["slot04"] = {
["ID"] = nil},
["slot05"] = {
["ID"] = nil}
},
["boosterCoin"] = {
["ID"] = nil,
["timeActivated"] = nil -- unix time
},
["Perfume"] = {
["ID"] = nil,
["timeActivated"] = nil -- unix time
}
}
Please do note that I’ll be adding more data to this as I develop my game. Is this inefficient and will this cause a lot of problems (e.g taking too long to load, delays)
TL:DR: I store playerdata thru ids then get the data in serverscript. will this cause any probs?