I know that the table you can use many things with the for i,v in pairs do but i know that you can put Model:GetChildren() and Players:GetPlayers() but what else can you use it for?
for i,v in pairs(what else can we do here?) do
end
I know that the table you can use many things with the for i,v in pairs do but i know that you can put Model:GetChildren() and Players:GetPlayers() but what else can you use it for?
for i,v in pairs(what else can we do here?) do
end
Oh, boy, there's a lot of uses for a table!
For an example, you can use it instead of using a lot of elseifs, a table can also be used to store per say userIds so you can make admin commands, or you can make whitelists.
However, I might've misunderstood your question, so, what else can we do inside of the brackets? Well, the only thing you can do there is provide a table, nothing else, that loop is made for iterating through tables.
Hope I answered your question, feel free to comment on my post if you'd like to ask about anything else.
You can also do Randomisers, like for example:
Colors = {
"New yeller";
"Really Red";
"Electric blue";
"Lime green";
}
ColorChosen = Colors[math.random(1,#Colors)]
script.Parent.BrickColor = BrickColor.new(ColorChosen)
Use this script as an help to your randomisers C:
You can also use: >game.ServerStorage:GetChildren() as an table
Thank you I really appreciate it.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
You can use it to store data within it such as items and create 'Dictionaries' which lets you set keys into values.