addEventHandler( "onPlayerChat", root, function( msg, ch )
cancelEvent() -- disable default chat and run our code instead.
if ch == 0 then
local newMsg = string.gsub(msg, '#%x%x%x%x%x%x', '') -- remove color codes from message
local newName = string.gsub(getPlayerName(source), '#%x%x%x%x%x%x', '')-- remove color codes from name
outputChatBox( newName..': '..newMsg, root, 255, 255, 525)
end
end )