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

How come the textbox turns white instead of blue?

Asked by 3 years ago
local textBox = script.Parent

local secretWord = "Testing1"
local colorWrong = Color3.new(1, 0, 0) -- red
local colorCorrect = Color3.new(0, 1, 0) -- green
local colorNormal = Color3.new(42, 84, 126) -- blueish


textBox.ClearTextOnFocus = false
textBox.Text = ""
textBox.Font = Enum.Font.Code
textBox.PlaceholderText = ""
textBox.BackgroundColor3 = colorNormal



local function onFocused()
    textBox.BackgroundColor3 = colorNormal
end

local function onFocusLost(enterPressed, inputObject)
    if enterPressed then
        local guess = textBox.Text
        if guess == secretWord then
            script.Parent.TextLabel.Visible = false
if script.Parent.Text == "Testing1" then
script.Parent.TextLabel.Visible = true
else
print("Test")
end
            textBox.Text = "TestRight"
            textBox.BackgroundColor3 = colorCorrect
        else
            textBox.Text = "TestWrong"
                        textBox.BackgroundColor3 = colorWrong
            end
            else
                textBox.BackgroundColor3 = colorNormal
    end
        end

textBox.FocusLost:Connect(onFocusLost)
textBox.Focused:Connect(onFocused)

How come the textbox turns white instead of blue?

1 answer

Log in to vote
0
Answered by
Memotag 226 Moderation Voter
3 years ago

Color3.new() is between 0 - 1

Consider using Color3.fromRGB() instead.

0
ty DevSeveral 19 — 3y
Ad

Answer this question