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)
1 Like
jaminz4
(jamie)
May 9, 2023, 3:13am
2
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.
jaminz4
(jamie)
May 10, 2023, 1:51am
6
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.
jaminz4
(jamie)
May 10, 2023, 2:03am
8
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.
Ze_tsu
(Ze_tsu)
May 10, 2023, 2:12am
10
Here’s a post with an example rainbow gradient:
I know that you can use UIGradients for for example frames, text label backgrounds and more.
Is there a way to use gradients instead of a normal text RGB color, or would I have to use a pre-made image for that?
xg1y
(safe_distance)
May 10, 2023, 2:16am
11
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.
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
jaminz4
(jamie)
May 10, 2023, 3:09am
13
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?
17kSeso
(semih)
May 25, 2023, 9:40am
16
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
Your method… is good but why localscript instead of script , i wanna make compatible without RunService
xg1y
(safe_distance)
December 2, 2024, 5:32pm
18
It’s preferred to bind runservice events locally if you care about optimisation.