Basic values into strings from text in text box

hello. im trying to make a gui that the player can change there theme color to a hex color. (HAS TO BE HEX)

the theme color will change accordingly.

i have 3 text boxes which change different parts. (backgrounds, buttons, etc)

1: backgrounds color

2: secondary color

  1. button color.

so far my script:

background_color = script.parent:WaitForChild("backgroundColorTextBox")
button_color = script.parent:WaitForChild("buttonColorTextBox")
secondary_color = script.parent:WaitForChild("secondaryColorTextBox")

script.parent.MouseButton1Click:Connect(function()
backgroundframe1.backgroundcolor = background_color -- some form of tostring but with hex
backgroundframe2.backgroundcolor = background_color -- some form of tostring but with hex
--
buttonframe1.backgroundcolor = background_color -- some form of tostring but with hex
buttonframe1.backgroundcolor = background_color -- some form of tostring but with hex
--
secondaryframe1.backgroundcolor = background_color -- some form of tostring but with hex
secondaryframe2.backgroundcolor = background_color -- some form of tostring but with hex

essential note: secondaryframe1, 2, backgroundframe1, 2, and buttonframe1, 2 dont exist and are for demonstrational purposes

workspace:

Wdym by hex color? And see youtube, there are tons of color picker gui tutorials

hex isnt the same of what your thinking of

is an example of hex colors.

image

the reason im using hex is becuase most color pallete sites use hex and im trying to find out what i think looks best

If I’m understanding the question, using Color3.fromHex should work.
Edit: Removed sidenote

do i have to to string() that?

example

buttonframe1.backgroundcolor = tostring(Color3.fromhex(background_color))?

since this would manually types in

Nope, it just returns a Color3 value.

buttonframe1.backgroundcolor = Color3.fromhex(background_color)

let me finilize my script before i give you answer

this should work right?















local backgroundframe1 = 
local backgroundframe2 =
	--
local buttonframe1 =
local buttonframe2 =
	--
local secondaryframe1 =
local secondaryframe2 =
	
	
	
	
	
	--
	--
	--
	--
	--
	--
	--
	--
	
	
	
	
local background_color = script.parent:WaitForChild("backgroundColorTextBox")
local button_color = script.parent:WaitForChild("buttonColorTextBox")
local secondary_color = script.parent:WaitForChild("secondaryColorTextBox")

script.parent.MouseButton1Click:Connect(function()
	backgroundframe1.backgroundcolor = Color3.fromhex(background_color)
	backgroundframe2.backgroundcolor = Color3.fromhex(background_color)
	--
	buttonframe1.backgroundcolor = Color3.fromhex(button_color)
	buttonframe1.backgroundcolor = Color3.fromhex(button_color)
	--
	secondaryframe1.backgroundcolor = Color3.fromhex(secondary_color)
	secondaryframe2.backgroundcolor = Color3.fromhex(secondary_color)
local backgroundframe1 = 
local backgroundframe2 =
	--
local buttonframe1 =
local buttonframe2 =
	--
local secondaryframe1 =
local secondaryframe2 =
	
	
	
	
	
	--
	--
	--
	--
	--
	--
	--
	--
	
	
	
	
local background_color = script.parent:WaitForChild("backgroundColorTextBox")
local button_color = script.parent:WaitForChild("buttonColorTextBox")
local secondary_color = script.parent:WaitForChild("secondaryColorTextBox")

script.parent.MouseButton1Click:Connect(function()
	backgroundframe1.backgroundcolor = Color3.fromhex(background_color.Text)
	backgroundframe2.backgroundcolor = Color3.fromhex(background_color.Text)
	--
	buttonframe1.backgroundcolor = Color3.fromhex(button_color.Text)
	buttonframe1.backgroundcolor = Color3.fromhex(button_color.Text)
	--
	secondaryframe1.backgroundcolor = Color3.fromhex(secondary_color.Text)
	secondaryframe2.backgroundcolor = Color3.fromhex(secondary_color.Text)
end)

ok so its not working after i filled in all the data. its not giving an error as well.

code:

local panel = script.Parent.Parent.Parent.panel
local GameUi = panel.Parent

local background1 = GameUi:FindFirstChild("Inventory")
local background2 = GameUi:FindFirstChild("Trade")
--


local trade = background2:FindFirstChild("Trade")
local Tbutton = trade:FindFirstChild("Tbutton")

local trade2 = background1:FindFirstChild("Trade")
local Ebutton = trade2:FindFirstChild("Ebutton")
--

local coins = GameUi:FindFirstChild("Coins")
local buttons = GameUi:FindFirstChild("Buttons")












local backgroundframe1 = background1
local backgroundframe2 = background2
	--
local buttonframe1 = Tbutton
local buttonframe2 = Ebutton
	--
local secondaryframe1 = coins
local secondaryframe2 = buttons
	
	
	
	
	
	--
	--
	--
	--
	--
	--
	--
	--
	
	
	
	
local background_color = script.parent:WaitForChild("backgroundColorTextBox")
local button_color = script.parent:WaitForChild("buttonColorTextBox")
local secondary_color = script.parent:WaitForChild("secondaryColorTextBox")

script.parent.MouseButton1Click:Connect(function()
	backgroundframe1.backgroundcolor = Color3.fromhex(background_color.Text)
	backgroundframe2.backgroundcolor = Color3.fromhex(background_color.Text)
	--
	buttonframe1.backgroundcolor = Color3.fromhex(button_color.Text)
	buttonframe1.backgroundcolor = Color3.fromhex(button_color.Text)
	--
	secondaryframe1.backgroundcolor = Color3.fromhex(secondary_color.Text)
	secondaryframe2.backgroundcolor = Color3.fromhex(secondary_color.Text)
end)

image:


after pressing apply changes it does nothing

if you want i can give model with all of stuff in it

hey its been a day. have you given up?



Color3.fromHx() capital H

2 Likes

People have other obligations.

Anyways, have you tried any print debugging?

i got it working already thanks for the help