How can I make this textlabel rainbow

title.
Here’s the script:

local groupID = 17172847


game.Players.PlayerAdded:Connect(function(player)
	local groupRank = player:GetRoleInGroup(groupID)
	local clone = script.Rank:Clone()
	clone.Parent = game.Workspace:WaitForChild(player.Name).Head
	clone.Frame.Name1.Text = player.Name
	clone.Frame.Rank.Text = groupRank
	
	player.CharacterAdded:Connect(function()
		local groupRank = player:GetRoleInGroup(groupID)
		local clone = script.Rank:Clone()
		clone.Parent = game.Workspace:WaitForChild(player.Name).Head
		clone.Frame.Name1.Text = player.Name
		clone.Frame.Rank.Text = groupRank
	end)
end)

What are you trying to achieve? The title just says “rainbow” do you mean a rainbow gradient? Colour changing?

1 Like

just use a ui gradient and put like a few colors

1 Like

how do i do that? I’m new to gradients.

yes, a rainbow color changing.

This should work, also pretty lag efficient

while task.wait(1/20) do 
	script.Parent.TextColor3 = Color3.fromHSV(tick() % 20/20, 1, 1)
end

Put this code in a script inside your rank TextLabel

2 Likes

Any loop isnt very efficient.

It’s updating every one 20th of a second, best method of doing this smoothly I’ve found so far as it only peaks at 0.2% activity

That’s still not very efficient, if you are Handling this on the Server with multiple Players, it will cause lag.

And no it does not wait a 20th of a Second, task.wait() is not always accurate with its yielding when it comes to time, its faster then the Deprecated wait(), but its still not accurate with small numbers.

Here’s a post with an example rainbow gradient:

Here is a method I sometimes use, you can do alot with manipulating UIGradients, definitely something to learn if you want to make your UI look 100x better.

FcYkNL6V

uigradient.rbxl (47.4 KB)

4 Likes

but how do i make it so that only the owner and specfic roles can have rainbow color

Go into the script inside of the textlabel, and set Enabled to false by unchecking the box. When cloning the label to the players character, set Enabled to true if they are a rank you want to have a rainbow name tag

Could you please help me with that?

local groupID = 17172847


game.Players.PlayerAdded:Connect(function(player)
	local groupRank = player:GetRoleInGroup(groupID)
	local clone = script.Rank:Clone()
	clone.Parent = game.Workspace:WaitForChild(player.Name).Head
	clone.Frame.Name1.Text = player.Name
	clone.Frame.Rank.Text = groupRank
	
	player.CharacterAdded:Connect(function()
		local groupRank = player:GetRoleInGroup(groupID)
		local clone = script.Rank:Clone()
        local UIGradient = Instance.new("UIGradient")

		clone.Parent = game.Workspace:WaitForChild(player.Name).Head
		clone.Frame.Name1.Text = player.Name
		clone.Frame.Rank.Text = groupRank
	end)
end)

Just edit colors of UIGradient