LogService
You should be using LogService
to recieve the messages from the Output.
Keep in mind that a lot of these functions are used for Core Scripts so some may not be usable.
But with the of MessageOut
, we can get the Messages from the output, with MessageOut
we have 2 Arguments, Message
, and MessageType
, this Message can vary, it could be an Error, or it could be a warning, so with this table, you can store the MessageType as the index, and sotre a piece of data you want it to hold, in this example, I made it hold some functions that go accordingly with the MessageType
:
local Stats = {
[Enum.MessageType.MessageError] = error, -- for errors
[Enum.MessageType.MessageWarning] = warn, -- for warnings
[Enum.MessageType.MessageOutput] = print -- standard output messages
}
Info here
Which as you can see, It could help use to indicate what to use when MessageOut
will fire, so when it does we can simply index the MessageType
and fire the function inside, like so
game.LogService.MessageOut:Connect(function(msg, msgType)
Stats[msgType](msg) -- fires message under message type
end)
But for your Purpose, you can simply hold a Color3 value for a specific message instead of a function, and you can apply the Message of the Object you want to color:
game.LogService.MessageOut:Connect(function(msg, msgType)
TextLabel.TextColor3 = Stats[msgType] -- changes text color accordingly
TextLabel.Text = msg -- Applies text
end)