Hello everyone,
I have a script that stores a table in a Datastore, and for some reason, today, I am getting this error and can’t pinpoint the exact cause.
This is the script:
local dataStoreService = game:GetService("DataStoreService")
local TreeDataStore = dataStoreService:GetDataStore("TreeDataStore")
local Save = game.Workspace.SaveTree.ClickDetector
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(tostring(player.UserId).."-TreeData", TreeData)
end)
if success then
print("Retrieved TreeData Successfully")
else
warn("Error: ".. TreeData)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local success, errorMessage = pcall(function()
TreeDataStore:SetAsync(tostring(player.UserId).."-TreeData", TreeData)
end)
if errorMessage then
warn("Error: ".. errorMessage)
else
print("TreeData has been Saved.")
end
end)
Thank you in advance.