I want to cycle through a table and find the next value after finding a value that is true, it does exactly that, however the “next value” i was talking about doesnt change and I dont know why? I printed it and it doesnt seem to change. I have not tried any solutions since I don’t really know what to do.
local module = {}
function module.CreateGUI(Text, cd)
local tables = {
true,
false,
false,
false,
false,
false,
}
for i,v in pairs(tables) do
if tables[i + 1] == false then
print(i + 1, tables[i + 1])
tables[i + 1] = true
-- take note that the script runs through this scope so it should change
break
end
end
end
return module
So i printed it out on both sides of tables[i + 1] = true, and the 2nd value of the table only changes in the scope of the for loop and not on the actual module
Okay what i am saying is: When i change the value in the scope of the for loop, it does not change the value on the table which is outside of the for loop
Where are you printing tables outside of the for loop?
You are telling me it’s not changing the table but you don’t know that because you are not printing the table, or you didn’t include it in the screenshot.
the first print will print “false” the second print will print “true”
You can even print tables inside the for loop and you will see it look like