local listFrame = script.Parent
local fileTemplate = listFrame.FileTemplate
local function displayFiles(files)
local templateHeight = fileTemplate.AbsoluteSize.Y
local nextPosition = 0
for fileName, content in pairs(files) do
local fileInstance = fileTemplate:Clone()
fileInstance.Name = fileName
fileInstance.Text = tostring(content)
fileInstance.Parent = listFrame
fileInstance.Visible = true
fileInstance.Position = UDim2.new(0, 0, 0, nextPosition)
nextPosition = nextPosition + templateHeight
end
end
local function clearList()
for _, child in ipairs(listFrame:GetChildren()) do
if child:IsA("Frame") and child ~= fileTemplate then
child:Destroy()
end
end
end
local function updateList()
while true do
game.ReplicatedStorage.getFiles:FireServer()
wait(5)
end
end
game.ReplicatedStorage.getFiles.OnClientEvent:Connect(function(files)
clearList()
displayFiles(files)
print(files)
end)
game.ReplicatedStorage.getFiles:FireServer()
coroutine.wrap(updateList)()
When iterating through a table, index which in your case is called filename would be the name of the index, if you just removed the .Name part, however its name can just be a set of numbers which is known as an Array, but a table with the index as a Phrase or string, is known as a Dictionary.
The value part which is called Content would be the value of the index, if its an Instance, you can say value.Name, but if not, you would just have to refer to it as value.
I assume that the files is referring to the Player-3026... table. So fileName will refer to the index of the table, and content will refer to the content inside 1 table and so on. If you would like to get the Name section of the table that you are looping through, you can try content["Name"]