Hi all. I have a table that contains all of the routes in my bus driving game. This problem has totally stumped me and as a fairly proficient programmer I have no idea what is going on. (something supernatural?!)
allroutes = {"1","2","7","10","11C","15","22","25","36","42","50","57","58","60","72","89","99","490","X9"}
bus = workspace:WaitForChild(player.Name.."'s Car").BusValue.Value
Gui = player.PlayerGui.GUI.Routes.Selector:GetChildren()
for i,child in pairs(Gui) do
print("#"..i.."Route: "..allroutes[i])
child.Route.Value = allroutes[i]
end
The print outputs each part of the table as so: (I've only included two) #1 Route: 1 #6 Route: 15
EXCEPT... and this is the astounding bit... the Value assignment is completely broken. Well sort. There are numbered imagebuttons from 1 to 19, and the code cycles through each and adds the next number in the table to the numbered imagebutton's value. So the last imagebutton is called "19" and should* have a value of "X9" but here is what actually happens...
#(1): 1 #(2): 2 #(3): 10 #etc... (as normal) #(6): 42 should be: 15 #(7): 60 should be: 22 #(8): 25 (correct) #(19): 89 should be: X9.
The assignments are all jumbled up and not going in the order that they appear in the table. Can anyone see the problem here? I am stumped on this one. Thanks.

1 comment
Aha! I completely glossed over the fact they might not be in the order I wanted them. They were numbered but hey-ho you're code worked. Thanks :D