Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why isn't table being stored in datastore2?

Asked by 2 years ago

I'm making a saving system using datastore2 that saves the porperties of every part in a grid. It's being added in a table, but when I try to save it to the datastore and print it, it doesn't seem to be printing anything.

ver = 2
--just using a wait for now, too lazy to make a click detector
wait(10)

local players = game:GetService("Players")
local dataStore2 = require(1936396537)
local userDataStoreName = ver.."SavingSys"

local player
game.Players.PlayerAdded:Connect(function(plr)
    player = plr
end)


local save = {}
for i,part in pairs(game.Workspace.Playspace:GetChildren()) do
    if part then
        save[part.Name] = {["pos"] = part.Position, ["color"] = part.Color, ["mat"] = part.Material}
    end
end

dataStore2(userDataStoreName, player):Set(save)
print(dataStore2(userDataStoreName, player))

Answer this question