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

GUI Name and TextColor3 help?

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.

3 comments

0

What's the error code?

0

There is no error. It just doesn't want to change the color of the textlabel to orange if it's a MessageWarning.

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.

1 answer

✓ Accepted answer

I helped in chat

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

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

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