Ive just made an inventory/warehouse datastore and now I'm working on the loading part, but for some weird thing is that, in my main script, the data says: [wood],[stone],etc
But when I print the decoded table, it just shows table I have no idea what I'm doing wrong because frankly, I'm quite new to tables and datastores heres the script
local http = game:GetService('HttpService')
local databaseService = game:GetService("DataStoreService")
local globalDatabase = databaseService:GetDataStore("TentTest")
--LOADING
game.Players.PlayerAdded:Connect(function(player)
local ui = workspace.warehouses.ui
local folder = Instance.new("Folder")
folder.Parent = ui
folder.Name = player.UserId
local clone = game.ReplicatedStorage.guis.tenthouse:Clone()
clone.Parent = folder
local Current = globalDatabase:GetAsync(player)
if Current ~= nil then
local current = http:JSONDecode(Current)
print (current)
local frame = clone.Frame.ScrollingFrame
--SAVING
game.ReplicatedStorage.warehousestuff.warehouseevents.data.OnServerEvent:Connect(function(player,Data,item,quantity)
local Current = globalDatabase:GetAsync(player)
-- has data to add
if Current ~= nil and item.Folder.quantity.Value <= 1 then
print (Current)
local current = http:JSONDecode(Current)
local data = {
current,Data
}
local newdata = http:JSONEncode(data)
globalDatabase:SetAsync(player,newdata)
print (newdata)
elseif Current == nil then
local data = {
Data
}
local newdata = http:JSONEncode(data)
globalDatabase:SetAsync(player,newdata)
print (newdata)
elseif item.Folder.quantity.Value >= 1 and Current ~= nil then
print (Current)
local current = http:JSONDecode(Current)
local data = {
current,Data[item.Folder.quantity.Value]
}
local newdata = http:JSONEncode(data)
globalDatabase:SetAsync(player,newdata)
print (newdata)
end
end)
end)
YES i know its messy, its just a first draft

2 comments
DataStores already encode and decode tables using the respective methods, so why do it yourself ?
i dont think you can extract specific pieces from a non json decoded table (tell me if im wrong im not a professional on this) as im going to get quantities of the items as well