Hello Everyone.
I am working on an editor that allows you to change decorations of a Christmas Tree. And of course, one of these decorations is ornaments, which I’m currently testing.
I’ve created a script that saves a table with datastores, this table contains the necessary data to eventually load the Tree, currently the only thing stored in it is a color3.
However, The script doesn’t seem to be saving the table’s contents. Either it needs to be physical somehow or the inserted data itself has to be saved, I don’t know.
This is my code:
local dataStoreService = game:GetService("DataStoreService")
local TreeDataStore = dataStoreService:GetDataStore("TreeDataStore")
local TreeData = {}
game.Players.PlayerAdded:Connect(function(player)
table.insert(TreeData, {R = 255, G = 0, B = 0})
local success, TreeData = pcall(function()
return TreeDataStore:GetAsync(player.UserId, TreeData)
end)
if not success then
wait("Error Getting TreeData")
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local success, errorMessage = pcall(function()
TreeDataStore:SetAsync(player.UserId.."TreeData", TreeData)
end)
if errorMessage then
wait(error())
end
end)
This is the error message I’m getting when I check to see if it works:
Thank you.