Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Problem With Color Equaling Text?

Asked by
Aepeus 59
8 years ago

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!

0
what is the text and what is the value UniversalDreams 205 — 8y
0
Text is a textbox and the value is a color3value Aepeus 59 — 8y
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. Sublimus 992 — 8y

1 answer

Log in to vote
0
Answered by
Sir_Melio 221 Moderation Voter
8 years ago
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.

0
For some reason it makes the value black even if I type in a string. Aepeus 59 — 8y
Ad

Answer this question