Changing the color of a string

Ok… I have an issue and I want you to help me I want to change the color of a text but not all of it I mean this :

local Players = game:GetService("Players")
local nameTag = script.Parent

local Id = 10826101

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		repeat wait() until character.Head

		local plrTag = nameTag:Clone()
		plrTag.PlayerName.Text = "{ " ..player.DisplayName.. " }"

		if player:IsInGroup(Id) then
			plrTag.PlayerRank.Text = "["..player:GetRoleInGroup(Id).."]"
			if player:GetRankInGroup(Id) == 5 then -- Owner
				plrTag.PlayerRank.TextColor3 = Color3.new(1, 0, 0)
			elseif player:GetRankInGroup(Id) == 4 then -- Friends,CC
				plrTag.PlayerRank.TextColor3 = Color3.new(0.5, 0, 1)
			elseif player:GetRankInGroup(Id) == 3 then -- Admin
				plrTag.PlayerRank.TextColor3 = Color3.new(0, 1, 0)
			elseif player:GetRankInGroup(Id) == 2 then -- Vip
				plrTag.PlayerRank.TextColor3 = Color3.new(1, 1, 0)
			elseif player:GetRankInGroup(Id) == 1 then -- Member
				plrTag.PlayerRank.TextColor3 = Color3.new(1, 1, 1)
			else player:GetRankInGroup(Id)
				plrTag.PlayerRank.TextColor3 = Color3.new(1, 1, 1)
			end
		else
			plrTag.PlayerRank.Text = "[none]"
		end
		plrTag.Parent = character.Head

	end)
end)

this is my script and in this line :

			plrTag.PlayerRank.Text = "["..player:GetRoleInGroup(Id).."]"

when I just want to change the color of player:GetRoleInGroup(Id)
it changes all of this :"["..player:GetRoleInGroup(Id).."]"
pls help me :_)

1 Like

or:

local Players = game:GetService("Players")
local nameTag = script.Parent

local Id = 10826101
local color = "255,255,255"

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		repeat wait() until character.Head

		local plrTag = nameTag:Clone()
		plrTag.PlayerName.Text = "{ " ..player.DisplayName.. " }"

		if player:IsInGroup(Id) then
			plrTag.PlayerRank.Text = "["..player:GetRoleInGroup(Id).."]"
			if player:GetRankInGroup(Id) == 5 then -- Owner
				color = "255,0,0"
			elseif player:GetRankInGroup(Id) == 4 then -- Friends,CC
				color = "125,0,255"
			elseif player:GetRankInGroup(Id) == 3 then -- Admin
				color = "0,255,0"
			elseif player:GetRankInGroup(Id) == 2 then -- Vip
				color = "255,255,0"
			end
		else
			plrTag.PlayerRank.Text = "[none]"
		end
		plrTag.Parent = character.Head

	end)
end)
plrTag.PlayerRank.Text = "[<font color = \"rgb("..color..")\">"..player:GetRoleInGroup(Id).."</font>]"
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.