I’m thinking of maybe putting everything in a table and then setting it all at once but I’m not sure how to do that and I can’t find anything about it.
It’s just a variable, you can choose any name to it. index is the index of the current table item, in this case it’s the item numerical position in the table. item is the value of the current table item, in this case the instance that you are trying to set visible or invisible.
Here’s an example:
local tableTest = {
["hi"] = 1,
["what"] = 2,
["hello"] = 3,
}
for index, number in pairs(tableTest) do -- index and number are variables, so they can have any name!
print(index, number)
end
Yes, that’s right! If you don’t add an index (like this local table = { "hi" }) then it will just be the numerical position of the table item, in this case hi will have the index of 1.
I mean the code does look like this: for index, item in pairs(tableClasses) do item.View = true for index, item in pairs(tableReplaceClasses) do item.View = false end end
but it is motivating me!
In addition to this, it’s also recommended you instead use task.wait() from the task library as its more efficient and works with the task scheduler.
task.wait(0.0333) -- 1/30th of a second
task.wait(0.1667) -- 1/60th of a second
--[[
from what ive tested, this is the lowest wait time it can go
however, this is very dependent on the current performance of the machine
wait delays like these are only possible in the command bar
]]
task.wait(0.0008)