Hello! I’m attempting to create a “Save Slot” UI where a lot of data characteristics of a model needs to be saved. I want to do this using the JSON Encode and Decode method but I only know how to save 1 specific table each time, I’m not sure how I’d go on about getting previous “data” from the JSon value and then add the new json data to that.
A better way to understand this is I’m trying to enabled to save multiple “save slots” but all in one saved “String Value” in the DataStore.
local CurrentDataList = {}
-- player:FindFirstChild("Data_Folder").BoothData
local DataStat = game.ReplicatedStorage.Testing
if DataStat.Value ~= '' then -- getting previous saved data information (doesn't work)
local LoadedData = HttpService:JSONDecode(DataStat.Value)
table.insert(CurrentDataList,LoadedData)
print(LoadedData)
end
local nameFile = filename
local BoothModel = x:FindFirstChild("StandType")
local BaseColor = x.Base:FindFirstChild("FullColor")
local CounterColor = x.Counter:FindFirstChild("FullColor")
local Message = x.Display.DisplayPart.SurfaceGui:FindFirstChild("Message")
local ImageID = x.Display.DisplayPart.SurfaceGui:FindFirstChild("ImageID")
local Layout = x.Display.DisplayPart.SurfaceGui:FindFirstChild("Layout")
local Font = x.Display.DisplayPart.SurfaceGui:FindFirstChild("FontUse")
local ToSave = {
saveFile = filename,
saveModel = BoothModel.Value,
saveBase = BaseColor.Value,
saveCounter = CounterColor.Value,
saveMessage = Message.Value,
saveImage = ImageID.Value,
saveLayout = Layout.Value,
saveFont = Font.Value
}
local json = HttpService:JSONEncode(ToSave)
table.insert(CurrentDataList, json)
local FinalSaveData = HttpService:JSONEncode(DataStat)
DataStat.Value = FinalSaveData
print(json)
Code above is what I got so far, but again, doesn’t work like I want it to work. game.Rep…Testing is just a string value I’m testing before I mess testing with the Datastore itself