So I made a placement system and you can change its color, material etc. But the only thing that doesnt work is saving the build. here is my script:
local partTable = {} for i, inst in pairs(workspace:GetChildren()) do if inst.Name == "BuiltBlock" then local position = inst.Position local material = inst.Material local color = inst.BrickColor local size = inst.Size partTable[i] = {Position = position, Material = material, Color = color, Size = size} end end local success, err = pcall(function() BuildsDataStore:SetAsync(player.UserId, partTable) end) if err then print(err) end
So when i try to save it, it prints:
104: Cannot store Dictionary in data store. Data stores can only accept valid UTF-8 characters.
Please help!!
Edit: Ok, so I found a way to save the data. But, it saves all the values as one? What is happening here?
The issue isn't actually the dictionary- it's the contents. DataStores are effectively JSON tables, so they can only store numbers, booleans, tables, and strings. You could fairly easily store the Vector3s and Color3s as arrays/dictionaries like
local vector3 = { X = myVector3.X, Y = myVector3.Y, Z = myVector3.Z } local color3 = { R = myColor3.R, G = myColor3.G, B = myColor3.B }
If you found this answer helpful, do mark it as one.