This script currently takes the text from a textbox and places it before a player’s username in chat.
Unfortunately, when you add new lines using ctrl + J, it will too add it to your chat tag. I can limit the amount of text they add, but I don’t know how to completely remove of new lines.
I don’t know what to exactly search on the forum, but I have skimmed over some similar topics and none of them seem too applicable. It’d really help to know what I should be looking for/what to change.
This is the code that applies the custom name that has already been filtered as a chat tag.
textChatService.OnIncomingMessage = function(message: TextChatMessage)
local properties = Instance.new("TextChatMessageProperties")
if message.Status == Enum.TextChatMessageStatus.Success then
if message.TextSource then
local textplayer = game:GetService("Players"):GetPlayerByUserId(message.TextSource.UserId)
if textplayer.Character.NameLabel.TextBox.Text ~= nil then
local colorvalue = textplayer.Character.NameLabel.TextBox.TextColor3
properties.PrefixText = string.format("<font color='#%s'", colorvalue:ToHex()) .. string.format(">[%s] </font>", textplayer.Character.NameLabel.TextBox.Text) .. textplayer.DisplayName .. ": "
end
end
end
return properties
end
