Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Problem With Color Equaling Text?

I am trying to make where you type a color value into a textbox, and make that text change a frame's color to your own choice. For example if i type in the text "255,255,255" it would make the frame white.

script.Parent.FocusLost:connect(function(enterPressed)
    	if enterPressed then
		print 'you pressed enter!'
		local color = script.Parent.Parent.Parent.Parent.HomeScreenColor.Value
		color = script.Parent.Text
	end
end)

The local color is a color3value. For some reason the only thing appearing in the output box is the your pressed enter!

Thanks!

3 comments

0

what is the text and what is the value

0

Text is a textbox and the value is a color3value

0

When you access a object such as a color3Value by it's value, say color3Value.Value; the value gets saved to the variable you assign it to. So if you change the variable, it will not change the value of the object, but what the variable is pointing to.

1 answer

✓ Accepted answer
local color = script.Parent.Parent.Parent.Parent.HomeScreenColor
color.Value = Color3.new(script.Parent.Text)

First of all, a variable can't be edited unless you put a dot or brackets or something, otherwise it'll just change the variable's position, not edit it.

Second of all, you need to enter "Color3.new" to make the script recognize it's a color3 value.

1 comment

0

For some reason it makes the value black even if I type in a string.

This discussion is preserved as it was. New answers, comments, and votes are closed.