Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

help with tables and datastores?

so i saved a table that stores important data about parts for a building system, but i cant read it when i load the data and decode it:

parts=game:GetService("DataStoreService"):GetDataStore("PartStore"):GetAsync(player.UserId)
parts=Game:GetService('HttpService'):JSONDecode(parts)
print(parts[1].position)
for i=1,#parts do
newpart=Instance.new("Part")
newpart.Parent=workspace.PartHolder
newpart.Position=parts[i].position-- error here, its nil. i did test that the value IS saved
end
end)

any ideas for getting that value?

1 answer

You can't JSONEncode a Vector3 value, and you can't JSONDecode one. You'll have to serialize it beforehand and then deserialize it (construct it) again when you decode it.

There's not any built-in serialization/deserialization support for Roblox datatypes with DataStores.

This discussion is preserved as it was. New answers, comments, and votes are closed.