local NPC_Data = {
['Money'] = 0,
['NPCs'] = {
[1] = {
['Rank'] = 'Private',
['Lvl'] = 1,
['XP'] = 0,
['XPN'] = 100
},
[2] = {
['Rank'] = 'Sergeant',
['Lvl'] = 1,
['XP'] = 0,
['XPN'] = 100
},
}
}
This is the sort of data I need to save and load every time a player leaves and joins a server, but I am also questioning, if I add more data to that table, for example like this…
function AddNpc(Npc, rank)
local Last = NPC_Data['NPCs'][#NPC_Data['NPCs']]
NPC_Data['NPCs'][#NPC_Data['NPCs'] + 1] = {
['Rank'] = rank,
['Lvl'] = 1,
['XP'] = 0,
['XPN'] = 100
}
end
Would this still be salvable or the datastore would just ignore it completely and just save the 2 initial datas in the table?
I figured out how to load the data from the table into the NPC themselves, but i just need some help in saving it and loading it.