Get my custom chat to change between rainbow colors

You can write your topic however you want, but you need to answer these questions:

  1. **What do you want to achieve?**So, I got my custom chat. I want to make it a rainbow changing color. Which is confusing.

Script so far:

	local tags = Instance.new("Folder",plr)
	tags.Name = "Tags"
	if plr.Name == "xxMLGxx8643" then
		local newTag = Instance.new("IntValue",tags)
		newTag.Name = "AWESOME"
		local chatColor = Instance.new("Color3Value",newTag)
		chatColor.Name = "ChatColor"
		chatColor.Value = BrickColor.new("New Yeller").Color
	local tagColor = Instance.new("Color3Value",newTag)
	tagColor.Name = "TagColor"
	tagColor.Value = Color3.fromRGB(159, 243, 233)

	end
	
end)```

2. **What is the issue?** I was want to add a script that switches colors

Video of what I'm aiming for: https://www.youtube.com/watch?v=qI1gu5ivaiI

Picture in game, *I just want the AWESOME word to change colors:

![image|294x27](upload://hWGwYwPI5Dr6PwW4xztos4DxlIb.png) 

3. **What solutions have you tried so far?**  I've tried to add different script elements. I've watched multiple tutorials to help me, no dice.

Do you want that tag in the chat to become rainbow?

Please elaborate on “rainbow”. Do you want the text to cycle through colours or have a moving rainbow BG?

@RaxdiiGames @Tom_atoesSorry, I forgot my screenshot, I’ll get that

Fixed the sentence, Just the AWESOME part to change colors

@Tom_atoes @RaxdiiGames

30 char

1 Like

@Tom_atoes Yes, I want the text to cycle through

30char

Try studying TweenService, it probably has the tools you need. Then, use the TweenService to cycle between the appropriate Color3 values of the rainbow.

What you want to do is to first start at a R value of 255, then reduce R to 0 while increase G to 255, then do the same thing for G and B then B and R.

local ColorsTable = {R = 255, G = 0, B = 0}
local Colors = {"R", "G", "B", "R"}
local tagColor
tagColor.Value = Color3.fromRGB(255, 0, 0)
while tagColor and tagColor.Parent do
	for ColorNumber = 1, 3 do
		local FirstColor = Colors[ColorNumber]
		local SecondColor = Colors[ColorNumber + 1]
		for ColorValue = 0, 255 do
			ColorsTable[FirstColor] = 255 - ColorValue
			ColorsTable[SecondColor] = ColorValue
			tagColor.Value = Color3.fromRGB(ColorsTable.R, ColorsTable.B, ColorsTable.G)
		end
	end
end

Untested but this should work.

Paste this in the CreateMessageLabel function in DefualtChatMessage module, hope this helped :smiley:
ccchat

spawn(function()
		if PrefixLabel.Text == "[AWESOME] " then
			local h = 0
			while PrefixLabel and PrefixLabel.Parent do
				h = h + 1
				if h > 255 then
					h = 0
				end
				PrefixLabel.TextColor3 = Color3.fromHSV(h/255,1,1)
				game:GetService("RunService").Heartbeat:wait()
			end

		end
	end)
2 Likes

if you’re done with scripting the 'who gets the tag part" then i’d recommend using color sequences and changing the gradient in a while loop
like :

 for i=1,100 or while true do or what you want it to be   
     local tagColor=instance.new("color3Value",newtag)
        local startColor = Color3.new(255, 0, 0)
         local endColor = Color3.new(0, 0, 255)--so it shifts
        local sequence = ColorSequence.new(startColor, endColor)
         trtagColor.Value = sequence--or color=sequence

by the way you shouldn’t parent them directly in one argument go here, unless you want to do something else.

If you wanted you could make teams and make them the colour you want them? :yum: