Hello, I have some code here that is meant to get the children of a folder in the player and insert the name of each child into an array and for some reason the for i loop is not working. Everything else prints and the functions afterwards work just fine. I also have a couple functions nearly identical to this one that work just fine so I’m really lost and any help is very much apricated.
if Player:FindFirstChild('AutoDeleteFolder') then
print('Auto delete folder exists')
local AutoDeleteArray = {}
for i, v in pairs(Player.AutoDeleteFolder:GetChildren()) do
print(v.Name)
table.insert(AutoDeleteArray, v.Name)
end
print(AutoDeleteArray)
local success, errormessage = pcall(function()
DataStore:SetAsync(Player.UserId..'-autodelete', AutoDeleteArray)
if success then
print('saved auto delete!')
end
end)
end
Nah no errors or anything just the print and the table.insert wont work. I have no clue why either because I use a function nearly identical to this one just with different variables to save other data and it works just fine.
Yes everything prints apart from whats in the for loop, there is just some string values inside the folder and the folder is created by a server script when a player joins the game.
Yes it is, but that tells me why its not working lmao im so sorry for wasting your guys time, someone else wrote the code that puts the stringvalues into the folder on a local script so in the server the folder is empty