Help with color Change gui

  1. What do you want to achieve? I want the BrickColor to change for the one user inputted

  2. What is the issue? The color changes to gray and not the one inputted
    https://gyazo.com/c01503eca1f553612a7f548fd4df2029

  3. What solutions have you tried so far? I tried using Color3, and tostring(TextBox.Text)

This is my script:

script.Parent.MouseButton1Click:Connect(function()
	local box = tostring(script.Parent.Parent.Color.Text)
	wait()
	local flower = script.Parent.Parent.Parent.Parent.Parent.Character:FindFirstChild("flowerhead")
	if flower then
		flower.BrickColor = BrickColor.new(box)
	end
end)
1 Like

Does it work, if you type “Bright Red”, instead of “Bright red”?

I’m not sure brick color is a property of a UI element.
If this is a GUI element, it likely has properties called ‘BackgroundColor3’ and ‘BorderColor3’. You need to input it as

BackgroundColor3 = script.Parent.BackgroundColor3 --anything so long as it's "Color3"

It changes it to gray color instead of Bright red

Im trying to change the flower’s head BrickColor

If I understood correctly. Your UI text box input should change the BrickColor value of a specified part in the workspace?

Are you trying to change it for the whole server or just the player?

Thats exactly what im trying to do

Ah so this isn’t a UI element,
is the flower a mesh, or a union, or just a model?

Union that uses the part BrickColor

1 Like

I can’t see anything wrong here.
My only workaround would be to attempt to have the player break the input with ‘,’ to format it like ‘25,60,78’
Then use ‘string.split()’ to break the input into three values.

Im trying to make the flower’s head BrickColor change to the inputted one
For example
Box content = Bright red
part.BrickColor = BrickColor.new(box.Text)
I tried using tostring() but it still didnt work

I think your problem is possibly the if statement that checks if the flower is null. (if flower then)

You should add a print right after the if statement. Since FindFirstChild() will return null if the part you’re looking for does not exist.

I think “flowerhead” may not exist inside of Character when your if statement is being evaluated. Therefor, not changing the color.

Try this:

if flower then
    print("Found")
else
    print("Not found")
end

If “Not found” gets printed, then you’re flowerhead is missing inside the character model.

This is what happens when for example trying to change the flower’s head to Bright red https://gyazo.com/c01503eca1f553612a7f548fd4df2029

Could you try

flower.usePartColor = true
flower.BrickColor = BrickColor.new(box)

I know, I’m asking you to check if the flower is in fact being found by the script.

If the script can’t find the flower, it will skip the if statement condition.

Yes the flowers head is defined

Can you confirm that using a print(“”) inside the if statement?

It uses PartColor, otherwise it wouldnt affect the color

if flower then
	print("flower head found, player: "..flower.Parent.Name)
	flower.BrickColor = BrickColor.new(box)
end

https://gyazo.com/40da06293abc144265dcfecaf17cde71 the flower is defined as players head

2 Likes