http://wiki.roblox.com/index.php?title=Lua_Chat_System/Server_API/ChatService&redirect=no#Methods
I'm confused on how to use this, i would love an example. Preferably the AddSpeaker, and how to set the message, and the color.
Thanks, any examples will be much appreciated!
Requiring chatservice
So the first step to using the epic feature of the magic chat service, you need to do a thing called require.
I'm assuming you know what is require, if not: http://wiki.roblox.com/index.php?title=Global_namespace/Functions_specific_to_ROBLOX#require
So the chatservice is not a service (haha), and it is deeply hidden in the game.
local chat = require(game.ServerScriptService.ChatServiceRunner.ChatService)
AddSpeaker and GetSpeaker
These both functions are great!
So, AddSpeaker just adds a fake player onto the chat which can chat!
Here's an example:
local chat = require(game.ServerScriptService.ChatServiceRunner.ChatService) local speaker = chat:AddSpeaker("Bob") -- adds bob speaker:JoinChannel("All") -- this will be required otherwise he wont be allowed to chat in the channel "All" speaker:SayMessage("Hey, my name is Bob!", "All") -- the "All" just makes it chat to the channel where everyone is!
Trying to add an existing speaker will result in an error. So here comes: GetSpeaker! It just tries to find a real player which can speak or a fake player in the chat.
Usage: chat:GetSpeaker("Speaker Name")
Once we get a speaker, we can change his Font, ChatColor and others!
Fonts, ChatColor, NameColor, etc.
This is the fun part. Not only you can make your text almost unreadable, but you can fake John Doe and make his chat pink!
The full list is: Font, NameColor, ChatColor, TextSize
Remember, always set those properties with SetExtraData
So, let's get John Doe and do some silly stuff to him!
local chat = require(game.ServerScriptService.ChatServiceRunner.ChatService) local speaker = chat:GetSpeaker("John Doe") -- gets john doe -- note, i did not add him to the channel ALL speaker:SetExtraData('Font', "Arcade") speaker:SetExtraData('NameColor', Color3.fromRGB(255, 255, 255)) speaker:SetExtraData('ChatColor', Color3.fromRGB(255,105,180)) speaker:SetExtraData('TextSize', 70)