Need help fixing rainbow server message

Hey, I have code which makes a server message rainbow, but what it does now is: lag the game and make the chat bubble white, I need help optimising the code and making it so the chat bubble text doesn’t go white

local TextChatService = game:GetService("TextChatService")
local ChatWindowConfiguration = TextChatService.ChatWindowConfiguration
local hue = 0

TextChatService.OnIncomingMessage = function(textChatMessage)
	if textChatMessage.Metadata == "specialCard" then
		game["Run Service"].Heartbeat:Connect(function()
			hue += 0.01
			local color = Color3.fromHSV(hue, 1, 1)
			ChatWindowConfiguration.TextColor3 = color
			if hue >= 1 then
				hue = 0

		local overrideProperties ="TextChatMessageProperties")
		overrideProperties.Text = string.format("<font color='#FFFFFF'>%s</font>", textChatMessage.Text)
		return overrideProperties
1 Like

Why did you made another topic saying the same thing lol

I changed the code so I had to make another post

i think you just needed to edit the other one, changing the script from the topic.

EDIT: see, i’m showing ya, that i can edit, (everyone that has the rank to reply have this power.)