Part referencing not good

Hello everyone, I have a small problem involving part referencing that doesn’t work. The variablele you see in the following script is referencing a Folder which contains parts, and the output says that I am attempting to call a nil value on line 6 and 8. How do I fix that? I tried putting Lights2 instead of parts, which hasn’t worked…

local Lights2 = script.Parent.Lights2

while true do
	for _,parts in pairs(Lights2:GetChildren()) do
		wait(1)
		parts.BrickColor = BrickColor.fromRGB(248, 248, 248) -- Line 6
		wait(1)
		parts.BrickColor = BrickColor.fromRGB(255, 255, 0) -- Line 8
	end
end

BrickColor doesn’t have a fromRGB constructor. What you probably want is something like BrickColor.new(Color3.fromRGB(248, 248, 248)).

1 Like