So, I'm testing data storing parts through a table library, and since you can't datastore libraries, im going to have to use JSONEncode and Decode right? Well the library has vector3 values in it and it isn't Encoding them. How would I make it so that JSONEncode includes these values? Thanks!
local DataStore = game:GetService('DataStoreService'):GetDataStore('BaseStore')
Bases = {}
if not DataStore:GetAsync('BaseStore1') then
print ("Yes")
local AddPart = function()
Bases['Part'] = {}
Bases.Part['Anchored'] = true
Bases.Part['Size'] = Vector3.new(5, 5, 5)
Bases.Part['Position'] = CFrame.new (0, 20, 0)
end
AddPart()
else
Bases = game:GetService('HttpService'):JSONDecode(DataStore:GetAsync('BaseStore1'))
print (game:GetService('HttpService'):JSONDecode(DataStore:GetAsync('BaseStore1')))
for i, v in pairs (Bases.Part) do
print (i)
end
end
local Part = Instance.new ('Part')
Part.Anchored = Bases.Part.Anchored
Part.Size = Bases.Part.Size
Part.CFrame = Bases.Part.Position
Part.Parent = workspace
print (game:GetService'HttpService':JSONEncode(Bases))
DataStore:SetAsync('BaseStore1', game:GetService'HttpService':JSONEncode(Bases))

4 comments
You're missing the parenthesis for the return of the JSONEncode in the EncodeVector3 function.
@Spongocardo You don't need parenthesis if you are only passing through a table or string
So I tested it and it works well even without the parenthesis. The more you know, I guess.
Okay thanks. I havent tried it yet but I looks like it will work. Ill let you know otherwise.