Huh, did I break it somewhere? What changes did you make to the code?
local TAGS
was changed to
local tags
not much
Oops, didn’t catch that, thank you! I’ve been playing around with my naming conventions this year and I didn’t notice that I used the wrong case when looking for the player’s tags.
I will update the original code sample to match.
I don’t think this is even a tutorial. You’re just telling everyone to copy and paste without explaining what each code line does.
What other data can you set using speaker:SetExtraData
?
Is there a way to find this out?
Hey since you were looking for something like this.
You probably might be looking for a chat icon as well. In that case check out this post. How to Add Custom Player Icons to Chat You can use both this post and his post in the same game.
There is no documentation for this because extra data is freeform. You can use extra data in any way you want to extend the Lua Chat System, like making your own modules (command or filter functions) that rely on certain extra data keys to modify how a chat will get processed. Name and chat colours are implemented this same way, just that they come with the default modules.
There are only three natively supported keys, as in if you didn’t fork or make any changes to the Lua Chat System then these keys will be set by the default modules injected at run time. Those keys are NameColor, ChatColor and Tags (a blank mutable table).
It’s worth noting that these extra data keys are set on a speaker-level as well; you can set it on a message-level if you’d like (as in, you could make a player’s chat appear as a different colour under a specific condition without making every chat they send that separate colouring).
Be careful as this could freeze the entire thread.
I rebuilt the system on a separate thread (useful in case you want use it and other things in a single script).
local function SetTag(Speaker, Player, Tag, Color)
if Speaker then
Speaker:SetExtraData("Tags", {{TagText = Tag, TagColor = Color}})
end
end
spawn(function() -- Initialize ChatService in another thread because yielding
local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
ChatService.SpeakerAdded:Connect(function(PlayerName)
local Player = game:GetService("Players")[PlayerName]
local Speaker = ChatService:GetSpeaker(PlayerName)
if Player and Speaker then
SetTag(Speaker, Player, "Admin", Color3.new(1, 0, 0))
end
end)
end)
I really like this but do you know how to make it rainbow using uiGradients where the gradients moves and not just change color
Really nice tutorial! I just have question
How do I make it an image?
You don’t. you can only have text and emojis in it.
How would you go about doing it per-message? Obviously I can’t find any information on it haha
That was amazing i was confused how it works
ChatMessage objects have an extra data field, as does the SayMessage function. You can do it in any number of ways as long as you keep in mind to modify the tags key of the ExtraData table. ChatSpeaker’s ExtraData table is to have a consistently sent ExtraData table when sending a message ergo to avoid the whole idea of constantly constructing and passing tags or other data every time a message is sent.
I am a new scripter and i kind off understood this tutorial
I followed the tutorial exactly but it’s not working for me. There is no output from the script. If it helps I’ve followed other tutorials for this and none of them have worked either so it’s definitely something on my end.
Apparently I’ve read ChatServiceRunner is deprecated already and therefore it doesn’t work. The solution to this is using TextChatService. This code worked for me. I put it in a LocalScript located in StarterGui. Hope this works for you.
local player = game.Players.LocalPlayer
local TCS = game:GetService("TextChatService")
TCS.OnIncomingMessage = function(message: TextChatMessage)
if not message.TextSource then return end
local properties = Instance.new("TextChatMessageProperties")
if player.Name == "Isipro_Ahre" then
properties.PrefixText = "<font color='#ff0000'>[Developer]</font> " .. message.PrefixText
end
return properties
end
I have created a post on how to create a custom chat tag in the latest chat service of Roblox. You can find it here :
can someone tell me a way to use group id and rank id to give tag
edit: TypeInt’s custom chat post has my answer
Insert a LocalScript into StarterPlayerScripts and then use this script.
local TextChatService = game:GetService("TextChatService")
TextChatService.OnIncomingMessage = function(message: TextChatMessage)
local properties = Instance.new("TextChatMessageProperties")
if message.TextSource then
local player = game:GetService("Players"):GetPlayerByUserId(message.TextSource.UserId)
if player.Name == "username" then
properties.PrefixText = "<font color='#2f0445'>[OWNER]</font> " .. message.PrefixText
end
end
return properties
end