Issues with using 3 textboxes to change a color 3 value

I’m really bad at explaining things so bare with me.

So I am trying to get a color3 value to change with 3 text boxes. So far I have had no luck.

Video:

If it helps here is the code:

local colorBox1 = script.Parent.TextBox1
local colorBox2 = script.Parent.TextBox2
local colorBox3 = script.Parent.TextBox3 
local previewPart = script.Parent.Parent.ChangeTo

-- Function to update the color preview
local function updatePreview()
	local r = tonumber(colorBox1.Text) or 0
	local g = tonumber(colorBox2.Text) or 0
	local b = tonumber(colorBox3.Text) or 0
	script.Parent.Change:Fire(r,g,b)
end

colorBox1.Changed:Connect(updatePreview)
colorBox2.Changed:Connect(updatePreview)
colorBox3.Changed:Connect(updatePreview)

The preview of the color and the value are supposed to update as you type the numbers in, but they aren’t.

(if needed here is the explorer)

No idea why it isn’t working.

Where is all the other code? The issue seems to be that you aren’t setting Color3 properly

This is the script in the ChangeTo value

script.Parent.Parent.COLOR.Change.Event:Connect(function(r,g,b)
	script.Parent.Value = Color3.fromRGB(r,g,b)
end)

And this is the script in the set.TextButton

local r = script.Parent.Parent.Parent.RBOX
local g = script.Parent.Parent.Parent.GBOX
local b = script.Parent.Parent.Parent.BBOX

local function tapOrClick()
	local red = tonumber(r.Text)
	local green = tonumber(g.Text)
	local blue = tonumber(b.Text)

	if red and green and blue then
		print(red)
		print(green)
		print(blue)
		game.Workspace.boatcontrol.outsideboatcolors.OutBoatLightC.Value = script.Parent.Parent.Parent.ChangeTo.Value
	end
end

script.Parent.MouseButton1Click:Connect(tapOrClick)
script.Parent.TouchTap:Connect(tapOrClick)

(the back button is not needed)

Does anything pass the if red and green and blue then statement?

If so then show me how the Color3 is being set.

They aren’t passing anything. Not sure why I added them.

Well your issue is how ever you are setting the ChangeTo value isn’t being set properly

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.