Emoji before nametag chat

The leaderboard on our game has chat tags but it’s using Roblox’s default system, I want the chat to have the emoji’s before the tag or at least look better, is there any method we can use to separate the emoji from the [Developer] tag without making a custom chat system?
image

4 Likes

Use ChatService for the tags. The following code should work below.

local players = game:GetService("Players")
local scriptService = game:GetService("ServerScriptService")

local ChatService = require(scriptService.ChatServiceRunner.ChatService)

ChatService.SpeakerAdded:Connect(function (speakerName)
	local userId = players:FindFirstChild(speakerName).UserId
	local speaker = ChatService:GetSpeaker(speakerName)
	
	if userId == DESIRED_USER_ID then
		-- do stuff
	end
end)

OR, you can see this Devforum Post made a while back, which should explain the tags.

(Edit: Didn’t read it correctly, it seems like you already had this script in game).

1 Like

This is going to require a little editing of the message creator modules but can be done without overriding too much of the default chat.

I think you could do this like:

  1. Edit the ExtraDataInitalizer module or where ever you add the tags to add a new emoji tag type that you add before the other tag, something like:
{
  EmotjiTag = true,
  TagText = "(emoji here)",
  TagColor = Color3.new(205/255, 0, 0)
}
  1. Edit the tag adding code in each of the MessageCreatorModules in the ClientChatModules to check for this value in the tags. If that value is in a tag, don’t add the brackets. e.g change it to something like so:
for i, tag in pairs(tags) do
  local tagColor = tag.TagColor or Color3.fromRGB(255, 0, 255)
  local tagText = tag.TagText or "???"
  local formatTagText = tag.EmotjiTag and tagText or string.format("[%s] ", tagText)
  local label = util:AddTagLabelToBaseMessage(BaseMessage, tagColor, formatTagText)
  label.Position = guiObjectSpacing

  numNeededSpaces = numNeededSpaces + util:GetNumberOfSpaces(formatTagText, useFont, useTextSize)
		guiObjectSpacing = guiObjectSpacing + UDim2.new(0, label.Size.X.Offset, 0, 0)

  table.insert(tagLabels, label)
end
2 Likes

Looked through the ExtraDataInitalizer module, I think I know how to solve the OP’s problem.

For multiple tags do this:

local Tags = {
	{
		TagText = "FIRST TAG HERE";
		TagColor = Color3.fromRGB(0, 0, 0)
	},
	{
		TagText = "SECOND TAG HERE";
		TagColor = Color3.fromRGB(255, 255, 255)
	}
}

and to add them, do this:

speaker:SetExtraData("Tags", Tags)


an example would be this:

local players = game:GetService("Players")
local scriptSerivce = game:GetService("ServerScriptService")

local ChatService = require(scriptSerivce.ChatServiceRunner.ChatService)

ChatService.SpeakerAdded:Connect(function (speakerName)
	local PLAYER_USER_ID = players:FindFirstChild(speakerName).UserId
	local speaker = ChatService:GetSpeaker(speakerName)
	
	if PLAYER_USER_ID == game.CreatorId then
		
		local TheirTag = {
			{
				TagText = "⭐";
				TagColor = Color3.fromRGB(math.random(1, 255), math.random(1, 255), math.random(1, 255));
			};
			{
				TagText = "Game Owner";
				TagColor = Color3.fromRGB(math.random(1, 255), math.random(1, 255), math.random(1, 255))
			}
		}
		
		speaker:SetExtraData("Tags", TheirTag)
	end
end)

Screenshot_86

3 Likes

I think OP wants the emoji to appear separately as opposed to use another tag - there’s also the issue of spacing. The module which creates the message labels would have to be edited to create another TextLabel for displaying the emoji before tags, the name and the message.

See solution by TheGamer101.