Trying to save an array to a datastore but I get this error
18:51:14.221 - ServerScriptService.save_script:207: attempt to get length of a userdata value
a bit of my function that im running
local child = terrain[i]
if child:IsA("Part") then
terrainxpositionStore[i]:Set(child.Position.X)
terrainypositionStore[i]:Set(child.Position.Y)
terrainzpositionStore[i]:Set(child.Position.Z)
CAP7A1N
(Cap)
June 7, 2020, 8:25pm
#2
Which line of the script provided are you getting that error?
You can save tables to a datastore the same as any other value.
Setting:
local exampleTable = {
val1 = "Cheese",
val2 = 4,
val3 = false}
datastore:SetAsync("DatastoreKey", exampleTable)
Getting:
local loadedTable = datastore:GetAsync("DatastoreKey")
local val1 = loadedTable.val1
local val2 = loadedTable.val2
local val3 = loadedTable.val3
1 Like
Can you use indexes instead of names?