Chat tags and other chat modifications module (Without forking the chat) + Rainbow Chat

Updated 5/10

Updates

5/10 - Added Rainbow Configuration
5/9 - Posted this resource

Recently, I was working on creating a chat tag system for my game, I decided to open source it since it is easy to use and quite useful!

Simply open up the ExtraDataModule and you can edit the tags from there
image

These are the three properties that can be adjusted! You can copy and paste a lot of the items to fit your liking!

Tag = {TagText = "Text", TagColor = Color3.fromRGB(255,255,255)},
NameColor = Color3.fromRGB(255,255,255),
ChatColor = Color3.fromRGB(255,255,255),
Rainbow = true,

Anyways, I hope this will help you out on a future project :smiley:
ChatCustomization.rbxm (3.4 KB)
Alternatively you could copy the code from my game here

Source Code
ChatCustomization Script
local EDM = require(script.ExtraDataModule)

local function setExtraData(player)
	
	local ChatService = require(script.Parent:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
	wait(5)
    if not(script.Parent:FindFirstChild("ChatServiceRunner")) and not(script.Parent:FindFirstChild("ChatServiceRunner"):FindFirstChild("ChatService")) then
		repeat
			wait(0.1)
		until script.Parent:FindFirstChild("ChatServiceRunner") and script.Parent:FindFirstChild("ChatServiceRunner"):FindFirstChild("ChatService") 
	end

	local speaker = ChatService:GetSpeaker(player.Name)
	local tags = {}
	local nameColor = nil
	local chatColor = nil
	local rainbowChat = false
	
	----------------------------------------------------------------------------------------
	
	for i,v in pairs(EDM.Players) do
		if v['PlayerId'] ~= nil then
			if player.UserId == v['PlayerId'] then
				if v['Tag'] ~= nil then
					table.insert(tags, v['Tag'])
				end
				if v['ChatColor'] ~= nil then
					if chatColor == nil then
						chatColor = v['ChatColor']
					end
				end
				if v['NameColor'] ~= nil then
					if nameColor == nil then
						nameColor = v['NameColor']
					end
				end
				if v['Rainbow'] ~= nil then		
					rainbowChat = true
				end
			end
		end
	end
	
	----------------------------------------------------------------------------------------
	
	local MarketplaceService = game:GetService("MarketplaceService")
	for i,v in pairs(EDM.Gamepass) do
		if v['GamepassId'] ~= nil and tonumber(v['GamepassId']) > 0 then
			if MarketplaceService:UserOwnsGamePassAsync(player.UserId,v['GamepassId']) then
				if v['Tag'] ~= nil then
					table.insert(tags, v['Tag'])
				end
				if v['ChatColor'] ~= nil then
					if chatColor == nil then
						chatColor = v['ChatColor']
					end	
				end
				if v['NameColor'] ~= nil then
					if nameColor == nil then
						nameColor = v['NameColor']
					end
				end
				if v['Rainbow'] ~= nil then		
					rainbowChat = true
				end
			end
		end
	end
	
	
	----------------------------------------------------------------------------------------
	
	for i,v in pairs(EDM.Groups) do
		if v['GroupId'] ~= nil and tonumber(v['GroupId']) > 0 then
			if v['Rank'] ~= nil then
				if player:GetRankInGroup(v['GroupId']) == v['Rank'] then
					if v['Tag'] ~= nil then
						table.insert(tags, v['Tag'])
					end
					if v['ChatColor'] ~= nil then
						if chatColor == nil then
							chatColor = v['ChatColor']
						end
					end
					if v['NameColor'] ~= nil then
						if nameColor == nil then
							nameColor = v['NameColor']
						end
					end
					if v['Rainbow'] ~= nil then		
						rainbowChat = true
					end
				end
			else
				if player:IsInGroup(v['GroupId']) then
					if v['Tag'] ~= nil then
						table.insert(tags, v['Tag'])
					end
					if v['ChatColor'] ~= nil then
						if chatColor == nil then
							chatColor = v['ChatColor']
						end
					end
					if v['NameColor'] ~= nil then
						if nameColor == nil then
							nameColor = v['NameColor']
						end
					end
					if v['Rainbow'] ~= nil then		
						rainbowChat = true
					end
				end
			end
		end
	end
	
	----------------------------------------------------------------------------------------
	
	local BadgeService = game:GetService("BadgeService")
	--BadgeService:UserHasBadgeAsync(player.UserId,badgeId)
	for i,v in pairs(EDM.Badges) do
		if v['BadgeId'] ~= nil and tonumber(v['BadgeId']) > 0 then
			if BadgeService:UserHasBadgeAsync(player.UserId,v['BadgeId']) then
				if v['Tag'] ~= nil then
					table.insert(tags, v['Tag'])
				end
				if v['ChatColor'] ~= nil then
					if chatColor == nil then
						chatColor = v['ChatColor']
					end	
				end
				if v['NameColor'] ~= nil then
					if nameColor == nil then
						nameColor = v['NameColor']
					end
				end
				if v['Rainbow'] ~= nil then		
					rainbowChat = true
				end
			end
		end
	end
	
	
	----------------------------------------------------------------------------------------
	
	if rainbowChat == true then
		local rainbowVal = Instance.new("BoolValue",player)
		rainbowVal.Name = "Rainbow"
		rainbowVal.Value = true
	end
	
	if #tags ~= 0 then
		speaker:SetExtraData("Tags",tags)
	end
	if chatColor ~= nil then
		speaker:SetExtraData("ChatColor", chatColor)
	end
	if nameColor ~= nil then
		speaker:SetExtraData("NameColor",nameColor)
	end
	
end

game:GetService("Players").PlayerAdded:Connect(function(player)
	print(player.Name)
	setExtraData(player)
end)

local clientClone = script.Client:Clone()
clientClone.Parent = game.StarterPlayer.StarterPlayerScripts
clientClone.Disabled = false
ExtraDataModule
local module = 
{
	Players = 
	{
		{
		
		PlayerId = 0,
		Tag = {TagText = "Game Creator", TagColor = Color3.fromRGB(255,255,255)},
		NameColor = Color3.fromRGB(255,255,255),
		ChatColor = Color3.fromRGB(255,255,255),
		Rainbow = true,
      
		},
	
	};
		
	Gamepass = 
	{
		
		{
		
		GamepassId = 0,
		Tag = {TagText = "VIP", TagColor = Color3.fromRGB(255,0,0)},
		
		}
		
		
	};
	
	Groups =
	{
		{
		
		GroupId = 0,
		Tag = {TagText = "Group Member", TagColor = Color3.fromRGB(255,255,255)},
		
		},
		{
		
		GroupId = 0,
		Rank = 2, -- Rank will make it where it only applies to that rank
		Tag = {TagText = "Contributer", TagColor = Color3.fromRGB(255,255,255)},
		ChatColor = Color3.fromRGB(255,255,255),
		
		},
	};
	
	
	
	Badges =
	{
	
		{
		
		BadgeId = 0,
		Tag = {TagText = "Alpha", TagColor = Color3.fromRGB(200, 0, 10)},
		NameColor = Color3.fromRGB(255,255,255),
		
		}
	
	
	
	};
	

}

return module
Client
local chatScroller = game.Players.LocalPlayer:WaitForChild('PlayerGui'):WaitForChild('Chat'):WaitForChild('Frame'):WaitForChild('ChatChannelParentFrame'):WaitForChild("Frame_MessageLogDisplay"):WaitForChild('Scroller')

local rainbowMessage = {}

chatScroller.ChildAdded:Connect(function(added)
	--print(added.Name)
	if added:IsA("Frame") then
		local username = added:FindFirstChild('TextLabel'):FindFirstChild('TextButton')
		if username then
			local playerWhoChatted = string.sub(username.Text,2,string.len(username.Text)-2)
			--print(playerWhoChatted)
			if game.Players:FindFirstChild(playerWhoChatted) then
				--print('player Found!')
				if game.Players:FindFirstChild(playerWhoChatted):FindFirstChild('Rainbow') then
					table.insert(rainbowMessage,added:FindFirstChild('TextLabel'))
				end
			end
		end
	end
end)



while true do
	for i=0,1,1/255 do
		for h,v in pairs(rainbowMessage) do
			if v ~= nil and v:IsA("TextLabel") then
				v.TextColor3= Color3.fromHSV(i,1,1)
			else
				table.remove(rainbowMessage,h)
			end
		end
		wait()
	end
end

If you find any bugs just alert me in this thread!

72 Likes

Very well made, easy to use source. I bet many people will appreciate this!

4 Likes

I am thinking about adding a rainbow chat feature to this module, would you guys use it/want it?

  • It would use it
  • I maybe would use it
  • I probably wouldn’t use it

0 voters

2 Likes

I have added the Rainbow Property


It is in the new updated module!

You should be able to transfer the ExtraDataModule under the new ChatCustomization Script

Simply add

Rainbow = true,

Under the section that you want to have Rainbow Chat!
If there are any other things that you want added, just say so here!

4 Likes

I will look into adding that! Thanks for the input!

2 Likes

Bar many code smells (including whole loops), a rainbow effect can be done through the ChatService API; you have no reason to edit the guis via an external script.
It’s possible to use a separate message type to create a rainbow effect (we do this for level up messages) and then add a custom ChatModule to mark messages from a specific source as being of this type.

3 Likes

Interesting, I did not know that, I will look into it! Thanks for pointing it out!
So you said that you can create a custom message type. Would I create a custom module and set its parent to ChatModules under Chat Service.

ChatModules let you create modules that influence the chat, and are designed more for commands and business logic. Message types are a different thing (although very similar).

The documentation (scroll down to Message creator modules) is very helpful with more details on how to do this.

2 Likes

I actually just made something similar to this. Mine makes chatbubble & tags rainbow. This is fairly cool too though!

4 Likes

Hey man!

Was using your module and it is kind of spreading to other people haha. I’m actually not sure if it’s client side cause nobody really told me but normal players sometimes have the rainbow chat and then it disappears over time. It’s a little weird. You might want to look into that.

2 Likes

Thanks for reporting, will look into that

This is a pretty cool module. I suggest making it so you can make the tag rainbow aswell. I fiddled with the code myself to make that happen.

7 Likes

Wow ! Could you pass me the modified script for the TAG? It really looks great. Good job.

In the module script, is there an option to only give rainbow chat for people who bought gamepass and or for specific group ranks only?

Simply add Rainbow = true, under the specs for the badge

Badges =
	{
		{
		BadgeId = 0,
		Tag = {TagText = "Alpha", TagColor = Color3.fromRGB(200, 0, 10)},
		NameColor = Color3.fromRGB(255,255,255),
		Rainbow = true, -- Add this 
		}
	};
2 Likes

Have you fixed the issue where the rainbow spreads to players without the rainbow permission?

I’ve been trying to replicate it, but found very little success, however I am working on redoing the rainbow itself

Hello! Sorry for bumping… is it possible so a certain group rank will have their tag, text, and name in rainbow? That would be really cool.

1 Like

How do I make players eligible for two tags (group and personal) only have the personal tag?

I don’t believe that that feature was ever implanted, that being said I believe that this project deserves an update :wink: