So I've been trying to iterate through the children of a folder located in ReplicatedStorage. It contains IntValues that I need to read the value of, so I can store them in a table and then store the table in a DataStore, however it doesn't work.I can iterate just fine throught the children of ReplicatedStorage, but not through the folder in ReplicatedStorage.
I have tried this with both a local script and a normal script. Here is my code:
Local Script:
Players = game:GetService("Players") repstorage = game:GetService("ReplicatedStorage") while wait(1) do for i,v in pairs(repstorage:FindFirstChild(Players.LocalPlayer.Name.."ItemFolder"):GetChildren()) do print("object") end end
Normal Script:
Players = game:GetService("Players") repstorage = game:GetService("ReplicatedStorage") while wait() do for _, plr in pairs(Players:GetPlayers()) do for _, v in pairs(repstorage:FindFirstChild(plr.Name.."ItemFolder"):GetChildren()) do print("children") end end end
The local script iterates through the children, but the normal script doesn't. How can I do this with a normal script?