Hello everybody, I have a problem that has been bugging me for quite a while.
So to make it easy for you to understand, let's say I have a table like so: MyMainTable = {} and a table called TheTable which is a table that comes with a function like so: .onClientEvent:Connect(function(TheTable)
So what I want to do here, is transfer the content of TheTable to MyMainTable, but to do so first I must remove the content of the table MyMainTable right? That's where the problem is at. The script simply won't remove all the content inside MyMainTable so, in the end, it gets all mixed. Here's that part of the code but with different table names:
script:WaitForChild("GiveAuditLog").onClientEvent:connect(function(TheTable)
--//First clean the table!
for i = 1,#AuditLog do
local v = AuditLog[i]
if v then
table.remove(AuditLog,i)
wait(.1)
end
end
-------------------------
for i = 1,#AuditLog do
local v = AuditLog[i]
if v then
print(AuditLog[i].." in the audit table")
wait(.1)
end
end
wait(.1)
for i = 1,#TheTable do
local v = TheTable[i]
if v then
print(TheTable[i].." in the table received")
wait(.1)
end
end
--Rest of the code
end)
--More rest of code..
while wait(1) do
for i = 1,#AuditLog do
local v = AuditLog[i]
if v then
print(v.." is here.") --Still says there are stuff remaining in the AuditLog table even after it was "supposedly" cleaned.
end
end
end
So if the AuditLog table, which is MyMainTable were to be like AuditLog = {"1","2","3","4","5","6"} then it would print out that 2,4,6 are still here! from the while wait loop I made to test.
That's the problem!
I can't use the table I received called TheTablebecause it's local to that function, and so I need to transfer it to other table to be used, but when I need to reuse that table some values will stay there mixing up the program!
I'm very very thankful to those helping.
If you need the full code, let me know.

2 comments
I'll try it once more
That worked! I can't believe I didn't notice that. Thank you very much!