Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can you do chatmakesystemmessage but in 2 colors?

Asked by 7 years ago

I understand it can do 1 color but how do you do 2?

example:http://prntscr.com/dz2ziw

2 answers

Log in to vote
1
Answered by 7 years ago

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

0
OMG THANK YOU SO MUCH!!!!!!!!!!!!!!!!!!!!!!!!!!!!! mightydifferent 85 — 7y
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! sactman64 7 — 5y
Ad
Log in to vote
0
Answered by 7 years ago

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

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. foreverpower 80 — 7y

Answer this question