Is there a way to arrange a table when using pairs loop?

Hello everyone,

I’m looking for a way to arrange a “GetChildren()” Table, so I can change the properties of multiple parts in order, and NOT randomly.

I can not think of a way to do it, I tried looking in the forum but it seems that there isn’t anything helpful.

Path = game.Workspace.Path:GetChildren()

for i,v in pairs(Path) do
	v.BrickColor ="Really red") -- A Random Example


I hope to see an easy solution, Thank You.

1 Like

Try to use this:

for i,v in pairs(game.Workspace.Path:GetChildren()) do
	v.BrickColor ="Really red")

string.format("%03i", n) pads any non-negative n with 0s to make it 3 digits (n > 999 is unchanged).

local path = workspace.Path
local numPath = #path:GetChildren()

for num = 1, numPath do
	local part = path[string.format("Part%03i", num)]
	part.BrickColor ="Really red")
1 Like

It’s the same thing, I don’t see how’s that suppose to arrange it?

Using generic for loops might just be the solution to this.

it seems to be working, I had to change a simple error you made, however:

Before:“Really red”)

part.BrickColor =“Really red”)

Other than that, it works just fine, thank you for your help :+1:

1 Like