I have some departure boards in folders. Image of my departure board and GUI
Basically, It takes user input of the required properties and updates the departure board. My script to update 1 departure board works fine but I would like to iterate over every departure board inside of a folder, and change text labels inside of them. Here is my current code:
allDepartures = {}
updateDepartures.OnServerEvent:Connect(function(player, departure)
allDepartures[#allDepartures + 1] = departure
local departureBoards = game.Workspace.departureBoards:GetChildren()
print(departureBoards)
for i, v in pairs(departureBoards) do
print(i, v)
for i = 1, 6, 1 do
local folder = v.SurfaceGui:FindFirstChild(i)
folder.Gate.Text = allDepartures[i][1]
folder.Status.Text = allDepartures[i][2]
folder.FlightNumber.Text = allDepartures[i][3]
folder.AorB.Text = allDepartures[i][4]
end
end
end)
The non-functional part of this is the for loop. when printing my departureBoards table it shows all contents of my departureBoards folder. However, when attempting to use this to iterate over each of my departureBoards, it the print statement inside of my for loop only prints the first item of my table. How would i get this to iterate over each of my departure boards, or is there a better way to do what i'm trying to do? Any help would be greatly appreciated. Thanks!

2 comments
Give that a go:P
Thank you so much. after some minor tweaking this updated everything :D