game.Players.PlayerRemoving:Connect(function()
local PartsToSave = {}
for i,v in pairs(workspace:GetChildren()) do
if game.ReplicatedStorage.Builds:FindFirstChild(v.Name) then
local PartProperties = {
v.Shape,
v.Position,
v.Orientation,
v.Size,
v.Anchored,
v.CanCollide
}
table.insert(PartsToSave, PartProperties)
end
end
local Key = "builds_save"
for i,v in pairs(PartsToSave) do
print(i)
end
local success, errormesage = pcall(function()
MyDataStore:SetAsync(Key, PartsToSave)
end)
if success then
print("success")
elseif errormesage then
warn(errormesage)
end
end)
I made a script for my building game which will save parts when the player leaves
Each part has it’s own table which stores the properties of the part, so I can use the table to load the part back in with the same properties
The table for each part is being stored inside of another table (called PartsToSave)
This is the error message that I’m being given:
104: Cannot store Array in data store. Data stores can only accept valid UTF-8 characters. - Server