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

GUI Name and TextColor3 help?

Asked by 8 years ago

So basically, I have this AdminGui that I've made, and you can script from it, but the player doesn't have a ServerLog they can use (This is a very privileged admin, for more advanced users. But it does have some fun commands.), so I scripted out another separate GUI that acts as an in-game output. In my script, I set the name of a textlabel to the Enum.MessageType, so I can change its TextColor3. They all work, except for Enum.MessageType.MessageWarning. I have no idea why this should be erroring.

Here's my script: (But before that, it should be noted that no other GUI interacts with this one, except for my AdminGui which only toggles visibility.)

function add(name)
    local o = Instance.new("TextLabel", script.Parent.EffectFrame.Frame)
    o.BackgroundTransparency = 1
    o.BorderSizePixel = 0
    script.Parent.k.Value = script.Parent.k.Value + 10
    o.Position = UDim2.new(0, 0, 0, script.Parent.k.Value)
    o.Size = UDim2.new(1,0,0,10)
    o.FontSize = "Size14"
    o.Name = name
    o.TextColor3 = Color3.new(255,255,255)
    o.TextWrapped = true
    o.TextScaled = true
    if o.Name == "Enum.MessageType.MessageInfo" then
        o.TextColor3 = Color3.new(0, 0, 255)
    elseif o.Name == "Enum.MessageType.MessageWarning" then
        o.TextColor3 = Color3.new(246, 185, 63)
    elseif o.Name == "Enum.MessageType.MessageError" then
        o.TextColor3 = Color3.new(255,0,0)
    end
    return o
end
game:GetService("LogService").MessageOut:connect(function(Message, Type)
    local msg = add(tostring(Type))
    msg.Text = Message
end)

K is a number value, which acts as a position.

0
What's the error code? User#5978 25 — 8y
0
There is no error. It just doesn't want to change the color of the textlabel to orange if it's a MessageWarning. MINEBLOX106 55 — 8y
0
Huh. So I took the RGB code from it, and put it where MessageError's TextColor3 is, caused an error, it printed out white. It's because it doesn't like the RGB code I'm using I guess. MINEBLOX106 55 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

I helped in chat

The problem was turning brickcolor to color3 this is possible by doing

newcolor3 = BrickColor.new("Bright yellow").Color
Ad

Answer this question