Ui Color Picker and Parts

so I’m working on a color picker and it works how its intended too for the most part, it creates shades and such with the correct color however when I try to transfer the color to a part it doesn’t work

Code the creates a button (Works)

	local function CreateColorButton()
		H, S, V = Hue, Sat, Val
		
		local ColorButtonClone = ColorButton:Clone()
		ColorButtonClone.BackgroundColor3 = Color3.fromHSV(H, S, V)
		ColorButtonClone.LayoutOrder = Order + 1
		ColorButtonClone.Parent = ColorHolderClone
		
		ColorButtonClone.Activated:Connect(function()
		ButtonActivated(Color3.fromHSV(H, S, V))
		end)

Code that changes baseplate color (does not work)

	local function ButtonActivated(Color)
		game.Workspace.Baseplate.Color = Color
		print("Test")
	end

I think it might have to do with it being baseplate.Color and not Color3, or that im using HSV does anyone have a solution for this?

1 Like

Does the “test” print?
(The fact that BasePart’s are Color and not Color3 is not affecting it, running this code worked for me)

workspace.Baseplate.Color = Color3.fromHSV(153, 86, 78)

it does print and this is on the wiki

all my values are 0 - 1 and it works for guis, just not parts

Have you tried using .fromRGB instead?

I’m assuming for your Hue, Sat and Val variables to be global, which will then be copied to H, S and V within your function. These are also global however, so each button would use the same values.

Consider placing the ‘local’ keyword in front of H, S, V.

I cant really use a RGB as I dont have a value for it

my script takes a preset RGB value then converts that into HSV then changes the HSV values to create different shades

that doesnt work either

that was a problem though

1 Like

local GenColorDebounce = false
function ColorModule.CreateColorBars()
	if GenColorDebounce == true then return end
	GenColorDebounce = true
	
	local function ButtonActivated(Color)
		print(Color.r)
		game.Workspace.Baseplate.Color = Color
		print("Test")
	end
	
	for _, Color in pairs(Colors) do
		
	local Hue, Sat, Val = Color3.toHSV(Color)
	local ColorHolderClone = ColorHolder:Clone()
	BarCount = BarCount + 1
	ColorHolderClone.Name = BarCount
	ColorHolderClone.LayoutOrder = BarCount
	local Order = 0
	
	local function CreateColorButton()
 		
		local H, S, V = Hue, Sat, Val
		
		local ColorButtonClone = ColorButton:Clone()
		ColorButtonClone.BackgroundColor3 = Color3.fromHSV(H, S, V)
		ColorButtonClone.LayoutOrder = Order + 1
		ColorButtonClone.Parent = ColorHolderClone
		local Part = Instance.new("Part", workspace)
		Part.Anchored = true
		Part.Position = Part.Position + Vector3.new(0, 0, positon)
		positon = positon + 4
		Part.Color = Color3.fromHSV(H, S, V)
		
		ColorButtonClone.Activated:Connect(function()
		ButtonActivated(Color3.fromHSV(H, S, V))
		end)
		
	end
	
	CreateColorButton()

	for i = 1, 8, 1 do
		local DHue, DSat, DVal = ColorDiffs[i][1], ColorDiffs[i][2], ColorDiffs[i][3]
		Hue = Hue - DHue
		Sat = Sat +- DSat
		Val = Val - DVal
		CreateColorButton()
	end
	ColorHolderClone.Parent = ColorScroll
	end
	
	local function GenSideColors(Color, SortOrder)
		for i, Color in pairs(Color) do
		local ColorButtonClone = ColorButton:Clone()
		ColorButtonClone.BackgroundColor3 = Color3.toHSV(Color)
		ColorButtonClone.SortOrder = SortOrder
		ColorButtonClone.Parent = ColorScroll:FindFirstChild(i)
			
		ColorButtonClone.Activated:Connect(function()
		
		end)
					
		end
		
		end
		
end

code so far

1 Like

Could you try printing the H,S,V values?

I must say, that is a lovely UI design :heart:

1 Like

Thanks and I’m scrapping this because I don’t think there is an easy solution so I just copied the colors manually and I’m using this

works perfectly

image

image

used color3 values and the screen color picker tool to get all my shades

1 Like