How to get this folder's children and change it's color

Hey Devs!

We’re going straight to the point image

How can I get the children on this folder:
image

And put it to this script so all children would change color


frame.Button.MouseButton1Down:Connect(function()
	local self = module.New(script.Parent,mouse)
	self:Init()
	
	local originalColor = part.Color
	self:SetColor(originalColor) --set color to current part color
	
	self.Finished:Connect(function(color)
		part.Color = color
	end)
	
	self.Updated:Connect(function(color)
		part.Color = color
	end)
	
	self.Canceled:Connect(function()
		--color canceled, set back to original color
		part.Color = originalColor
	end)
end)


You can use a for loop to get the children of the folder using pairs and GetChildren().

for index, part in pairs(folder:GetChildren()) do
--place code here
end

I’ve already tried this earlier and it seems to not working :disappointed_relieved:

Can you show the code you have with the loop?

Here

for index, part in pairs(folder:GetChildren()) do
	frame.Button.MouseButton1Down:Connect(function()
		local self = module.New(script.Parent,mouse)
		self:Init()


		local originalColor = part.Color
		self:SetColor(originalColor) --set color to current part color

		self.Finished:Connect(function(color)
			part.Color = color
		end)

		self.Updated:Connect(function(color)
			part.Color = color
		end)

		self.Canceled:Connect(function()
			--color picker canceled, set back to original color
			part.Color = originalColor
		end)
	end)

end

You should put the loop inside the first event function I believe.

2 Likes

Okay it now seems to be working. I appreciate the help!!