I want to search Data Storages under a spesific folder. Can i use for loop for that or there is another way?
local folderDescs = folder:GetDescendants() local potentialHit = table.find(folderDescs, SEARCHTERMHERE) if potentialHit then print(potentialHit) end
GetDescendants is really nice but I can’t use it for mine so here’s what I do.
local function scanFolder(Array, folder) for index, values in pairs (folder:GetChildren) if values:IsA(“Folder”) then Array[values.Name] = {} if values:GetChildren() ~= nil then scanFolder(Array[values.Name], values) end else Array[values.Name] = values.Value end end return Array end
And you just pass it the folder you want to search through and the Array or Table you want to JSONEncode India string. Also you can probably do Array[index] instead of values.Name since index is the name of the value lol
So like this
DataStoreArray = scanFolder({}, folderYouWantScannedIn)
This is for storing Folder Data in a Datastore without GetDescendants. If you want to just search the folder for a value GetDescendants is the best. But this way does exactly what get descendants does but you can control it.