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

Can you do chatmakesystemmessage but in 2 colors?

2 answers

✓ Accepted answer

Unfortunately, you can't make a chat message with two colors using chatmakesystemmessage, but luckily you can with the new chat system.

The new chat system allows us to create custom modules that can hook into the chat system, and do things like process commands and create messages.

To begin, we'll need to make a copy of the default modules:

  1. Go into Play Solo mode. This will load in the default modules.
  2. Look under the service named Chat in the Explorer.
  3. You should see a folder named "ChatModules". Copy it.
  4. Exit Play Solo mode and paste it into the now empty Chat service.

Now that we have a copy of the default chat modules, we can begin making our own. Right click > Insert Object > ModuleScript to create a new module in the ChatModules folder.

Here is the basic layout of a chat module:

local function Run(ChatService)
	
end

return Run

As you can see, the module creates and returns a function. This function will be called when the chat service starts. But the most important thing here is the ChatService instance that is passed into the function. This will allow us to interact with the chat system.

First, we create a new "speaker" named System. A speaker can be either a player or a bot that can send and receive chat messages, join chat channels, etc.

local SystemBot = ChatService:AddSpeaker("System")

Before the speaker is able to send or receive messages, though, it must first be in the chat channel it would like to receive from or send messages to. In this case, we want it to join the "All" channel, which is the default chat channel for all messages.

SystemBot:JoinChannel("All")

Now that we've created our bot and put it in the "All" channel, we can finally send a message.

SystemBot:SayMesage("Hello, world", "All")

Here is the completed code:

local function Run(ChatService)
	local SystemBot = ChatService:AddSpeaker("System")
	SystemBot:JoinChannel("All")
	
	SystemBot:SayMessage("Hello, world", "All")
end

return Run

And here is what you should see in the chat window: http://prnt.sc/dz3mml

If you want to read more about the new chat system, check the Wiki: http://wiki.roblox.com/index.php?title=Lua_Chat_System

2 comments

0

OMG THANK YOU SO MUCH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

0

Holy crap, I'll name my first newborn after you! And how you walked us through the steps too! Dear lord, what did we ever do to deserve your kindness!

As far as I know, ChatMakeSystemColor only supports one color. To do two colors, you'd need to make a Custom Chat GUI

1 comment

0

You are correct that ChatMakeSystemMessage is incapable of creating a chat message with a name tag, but there are other ways you can without creating an entirely new chat system.

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