You could store the data in a table, and then convert it into a string using HttpService:JSONEncode() and save it into the datastore. To get the table back, just get the datastore and HttpService:JSONDecode() it.
wow thanks for your advice , maybe i cant do that since im not a scripter [ still learning ].
is there another way to fix it? i still dont understand what to do with table
Crude sample, but this is what I normally do to save tables.
local datastoreservice = game:GetService("DataStoreService")
local httpservice = game:GetService("HttpService")
local playerDatastore = datastoreservice:GetDataStore("Data") -- or whatever datastore you want to save it to
local tabletosave = {
["Money"] = 999,
['Gems'] = 83,
["Cars"] = {
"Prius",
"Mazda",
"Toyota"
}
} -- Just an example of a table, it can be anything
local success, errormessage = pcall(function() -- to catch any errors
-- since tables cannot be directly stored in a datastore, we convert it into a string and save it to the datastore
playerDatastore:SetAsync("Data", httpservice:JSONEncode(tabletosave))
end)
if errormessage then warn(errormessage) end -- if it errors, it tells in the output with yellow text.
if i do tons of datastore , everytime player join
the game kept sending me alot of warning of key request something like that which means not a good thing?