How I can make this in ServerSide?

Hi I am trying to make a rainbow chat tag and I dont know how I can make a TagColor with rainbow effect on server side {TagText = "CREATOR", TagColor = Color3.fromRGB(255, 255, 255)}, ---this so I used a local script for that.

It works fine the problem is I cant make it work for all clients. Only I can see.

this is the script

local players = game:GetService("Players")
local plr = players.LocalPlayer

	local playerGui = plr:WaitForChild("PlayerGui")
	local chat = playerGui:WaitForChild("Chat")
	local frame = chat:WaitForChild("Frame")
	local chatChannelParentFrame = frame:WaitForChild("ChatChannelParentFrame")
	local frameMessageLogDisplay = chatChannelParentFrame:WaitForChild("Frame_MessageLogDisplay")
	local scroller = frameMessageLogDisplay:WaitForChild("Scroller")

	scroller.ChildAdded:Connect(function()
		for i, v in pairs(scroller:GetChildren()) do
			if (v:IsA("Frame")) then
				local textLabel = v.TextLabel
				local tag = textLabel:FindFirstChild("TextLabel")
				if tag and tag.Name ~= "Test" then
					local uiGradient = tag:FindFirstChild("UIGradient") or Instance.new("UIGradient", tag)
					tag.Name = "Test"
					while (v.Parent ~= nil) and plr.UserId == 660698828 do
						for j = 1, 255 do
							local color1 = Color3.fromHSV(j / 255, 1, 1)
							local color2 = Color3.fromHSV(j / 255, 1, 1)
							uiGradient.Color = ColorSequence.new({
								ColorSequenceKeypoint.new(0, color1);
								ColorSequenceKeypoint.new(1, color2);
							})
						wait()
					end
					wait()
				end
			end
		end
	end
end)

I tried to fire the chatGUI from client into server side but nothing helps. Any Idea?

Go into your chat modules (Go in game, copy them, paste them back in studio)

Chat > ClientChatModules > MessageCreatorModules > Util

Go to line 176 and add the gradient code there, so:

function methods:AddTagLabelToBaseMessage(BaseMessage, tagColor, formatTagText)
	local tagNameSize = self:GetStringTextBounds(formatTagText, BaseMessage.Font, BaseMessage.TextSize)
	local TagLabel = self:GetFromObjectPool("TextLabel")
	TagLabel.Selectable = false
	TagLabel.Size = UDim2.new(0, tagNameSize.X, 0, tagNameSize.Y)
	TagLabel.Position = UDim2.new(0, 0, 0, 0)
	TagLabel.BackgroundTransparency = 1
	TagLabel.Font = BaseMessage.Font
	TagLabel.TextSize = BaseMessage.TextSize
	TagLabel.TextXAlignment = BaseMessage.TextXAlignment
	TagLabel.TextYAlignment = BaseMessage.TextYAlignment
	TagLabel.TextTransparency = BaseMessage.TextTransparency
	TagLabel.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
	TagLabel.TextColor3 = tagColor
	TagLabel.Text = formatTagText
	TagLabel.Visible = true
	TagLabel.Parent = BaseMessage

	return TagLabel
end

Would be

function methods:AddTagLabelToBaseMessage(BaseMessage, tagColor, formatTagText)
	local tagNameSize = self:GetStringTextBounds(formatTagText, BaseMessage.Font, BaseMessage.TextSize)
	local TagLabel = self:GetFromObjectPool("TextLabel")
	TagLabel.Selectable = false
	TagLabel.Size = UDim2.new(0, tagNameSize.X, 0, tagNameSize.Y)
	TagLabel.Position = UDim2.new(0, 0, 0, 0)
	TagLabel.BackgroundTransparency = 1
	TagLabel.Font = BaseMessage.Font
	TagLabel.TextSize = BaseMessage.TextSize
	TagLabel.TextXAlignment = BaseMessage.TextXAlignment
	TagLabel.TextYAlignment = BaseMessage.TextYAlignment
	TagLabel.TextTransparency = BaseMessage.TextTransparency
	TagLabel.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
	TagLabel.TextColor3 = Color.fromRGB(1,1,1)
    local Gradient = Instance.new("UIGradient, TagLabel")
    Gradient.Color = -- put ur gradient color here
	TagLabel.Text = formatTagText
	TagLabel.Visible = true
	TagLabel.Parent = BaseMessage

	return TagLabel
end
1 Like

any way to do without using module scripts? Like I could use a loop on local script for make it visible for all clients?

That isn’t how LocalScripts work. That script will run for the player it’s running for and them only. If the LocalScript destroys a part, it will only destroy on that player’s screen. So basically you either need to use a Server Script or the method that @6Square4 gave you.

I could just do

for hue = 0, 1, 1/360 do
	wait()
	---(TagColor) = Color3.fromHSV(hue, 1, 1) 
end

but I dont know how I could put a loop inside

local OwnerTag = {
	[660698828] = {
		ChatColor = Color3.new(255, 255, 255),
		Tags = {
			{TagText = "CREATOR", TagColor = Color3.fromRGB(255, 255, 255)},
		}
	},
}

And using a module I think is the hard way

Ok it helps but I still have 2 questions

1- how I could loop the Gradient Color?

2- how I could make it work only for a specific user (By userId)

You could add the chat tag from server just like in your post How I can make this in ServerSide? - #5 by ToxicalGamer2006

Then you could add the effect on everyone’s client using a remote event. Basically have an OnClientEvent to add effect to the tag label and after that do :FireAllClients() on server so that way every player can see the rainbow effect.

I wouldn’t recommend you to do a rainbow effect on server, that would most likely cause lag and have a delay on the effect (I have made the same mistake before)

1 Like

If I fire the tag to the client will work if I fire back again? and how I can fire the tag for all Clients using :FireAllClients() ?

Nvm guys I found the issue.

I was using

while (v.Parent ~= nil) and plr.UserId == 660698828 do

soo basicly only would work for the user with this ID(me)

I already changed. Only have to set the tag.Name to the player ID and do if tag and tag.Name ~= plr.UserId then