How do I make a text box that shows errors? (like the developer console errors)

Hey developers! I know its a strange and niche question but, how do I make a text box that shows errors? (like the developer console errors)

For debugging purposes and developer environment purposes I guess would be my reason.

I researched everywhere and no one at least to my knowledge has brought up a question like this before.

You can use the LogService
It has useful events like MessageOut and :GetLogHistory

Example:

local logService = game:GetService("LogService")

-- Log history

for i, message in next, logService:GetLogHistory() do
	--> Code
	
	if message.MessageType == Enum.MessageType.MessageOutput then

	elseif message.MessageType == Enum.MessageType.MessageInfo then

	elseif message.MessageType == Enum.MessageType.MessageWarning then

	elseif message.MessageType == Enum.MessageType.MessageError then

	end
end

-- Message Out (When the console spits out a message)

logService.MessageOut:connect(function(message)
	--> Code
	
	if message.MessageType == Enum.MessageType.MessageOutput then
		
	elseif message.MessageType == Enum.MessageType.MessageInfo then
		
	elseif message.MessageType == Enum.MessageType.MessageWarning then
		
	elseif message.MessageType == Enum.MessageType.MessageError then
		
	end
end)

Hope this helps! :slightly_smiling_face:

3 Likes

Thanks for your reply! This works, and I appreciate it but is there anyway to add the timestamp of the error? I tried to use server message out timestamp as outlined here: LogService | Roblox Creator Documentation but it didn’t work. Do you know off any way to add this?

Also how would I change the color of the text based on the type of message? Like yellow for warning, red for error, etc. Thank you!

Use tick().

local t = tick()
("%02i:%02i:%02i"):format(t/60^2, t/60%60, t%60)

For the colors,

local Colors = {
    ["Output"] = Color3.new(1, 1, 1),
    ["Info"] = Color3.new(0, 0, 1),
    ["Warning"] = Color3.new(1, 0.5, 0),
    ["Error"] = Color3.new(1, 0, 0),
}

Then access the colors based on the type of message.
Feel free to use the color picker to set the color to whatever you are comfortable with.

1 Like