So the script I have is:
local cards = {{"a"},{"b"},{"c"},{"d"},{"e"},{"f"},{"g"}}
for i = 1,#cards + 1 do
if cards == 0 then
print"done"
else
local card = cards[math.random(#cards)]
print(card[1])
table.remove(cards,cards[card])
end
wait(.1)
end
What I believe this should do, when looping through the table, is find a child at random, print its content(s), and then remove it. When there are no more contents in the table left, it will print "done". When running the script, however, the output randomly prints:
f
c
e
c
a
a
a
and running it a second time:
f
c
b
a
b
a
a
even though supposedly removed from the table, the child somehow is repeated again in the script when looping through it another time (a,b and c for an example). for what I am doing the children of the table have to be other tables, so I can't change that. So what is wrong here? If you have a question for clarification please comment, All answers appreciated, thank you. ~Xduel

2 comments
Why do you need separate tables? It would be SO much cleaner and simpler to just put it in one table.
They would be holding other contents in them, for example cards = {{"a",2},{"b",4}{"c",6} ect.} in my case every table in the table must 4 place holders for 4 different values.