Creating every possible color does not work

im working on a script that will generate a path of blocks with all possible rgb combinations, but for some reason the first part is 0,0,0 but every next one is 0,0,1 and it doesnt change.

local currentcolor = Color3.fromRGB(0,0,0)
local currentrow = 1
local posinrow = 1
for i = 1,255^3 do
	local block = Instance.new("Part",workspace.Storage)
	block.Anchored = true
	block.Size = Vector3.new(1,1,1)
	block.Position = Vector3.new(0+block.Size.X*currentrow,0,0+block.Size.Z*posinrow)
	block.Color = currentcolor
	if posinrow < 50 then
		posinrow += 1
	else
		posinrow = 1
		currentrow += 1
	end
	if currentcolor.B < 255 then
		currentcolor = Color3.fromRGB(currentcolor.R,currentcolor.G,currentcolor.B+1)
	else
		if currentcolor.G < 255 then
			currentcolor = Color3.fromRGB(currentcolor.R,currentcolor.G+1,0)
		else
			if currentcolor.R < 255 then
				currentcolor = Color3.fromRGB(currentcolor.R+1,0,0)
			end
		end	
	end
	wait(0.1)
end


Did u try to put the currentcolor variable inside the for loop?

ill try but i think it will reset it each time. but ill try.

yea, now its 0,0,0 each time, it resets.

Okay maybe next idea - try to make Color3Value

1 Like

still the same. thats a very strange issue

Can you show me the code again?

well its the same i just added .Value each time i called the currentcolor variable and changed the currentcolor variable to game.ServerScriptService.CurrentColor

Hmm well and the currentcolor value is changing or not?

At the bottom of the loop I added a print(currentcolor), and here is what I got in the output:

Screen Shot 2021-02-24 at 7.56.00 AM

The value appears to be changing but it is changing by very small increments each time.

1 Like

why is this happening tho? im adding 1

Try not to do 0,0,1 but just 1?

I just tested this and this should work, however I must warn you that you are going to be spawning over 10 million parts if you let this run (255^3) so either it will get really laggy or it will take ages to load

local currentcolor = Color3.fromRGB(0,0,0)
local currentrow = 1
local posinrow = 1

for r = 1,255 do
	for g = 1,255 do
		for b = 1,255 do
			local block = Instance.new("Part",workspace.Storage)
			block.Anchored = true
			block.Size = Vector3.new(1,1,1)
			block.Position = Vector3.new(0+block.Size.X*currentrow,0,0+block.Size.Z*posinrow)
			block.Color = currentcolor
			if posinrow < 50 then
				posinrow += 1
			else
				posinrow = 1
				currentrow += 1
			end
			currentcolor = Color3.fromRGB(r,g,b)
			wait(0.1)
		end
	end
end