Can someone please explain what the "in pairs" in for loops does?
✓ ANSWER ACCEPTED
What does "in pairs" do?
1 answer
✓ Accepted answer
i = index v = the current index value this loops through the table for its values or parents for its children. this loop basically scans through everything inside an object or whatever and returns a value. Example:
for i, v in pairs(Workspace.Model:GetChildren()) do
if v.Name == "Wall" then
v.Transparency = 0.5
end
end
this would loop through a model in the workspace named model and look for an object with the name wall, if it find one, it would change the objects transparency to 0.5. This is usefully for changing multiple items in your place or getting special things from your player.
If you need more help, pm me at LevelKap on ROBLOX. thumbs up is appreciated, i wanna reach contributor status :DDDDDD
This discussion is preserved as it was. New answers, comments, and votes are closed.
