Hi, I really need help with sorting folders for database. I’m using GetDescendants so its bit harder to make then using just 1 layer of folders.
Issue?? there is lot of them. maybe 1 fix can break many thing that are currently working.
Soulutions?? I have tried some of them like finding if that folder exists and if it does then script place it into that folder and some simple ones.
What I get:
What I need:
Code:
for i,v in pairs(PD:GetDescendants()) do
if v:IsA("Folder") and client:WaitForChild("PlayerData") then
local folder = Instance.new("Folder")
folder.Name = v.Name
folder.Parent = PlayerDataFolder
if v.Parent.Name ~= "PlayerData" and PlayerDataFolder:WaitForChild(v.Parent.Name)then
for i, p in pairs(PlayerDataFolder:GetDescendants()) do
if p:WaitForChild(v.Parent.Name) then
folder.Parent = p[v.Parent.Name]
end
end
end
end
end
Don’t mind about values on picture I have perfect sorting for them