Changing the color of a variable

This is a script excerpt, I want the Team text to be the color of the player’s team.

script.chat.OnServerEvent:Connect(function(player, msg)
	local TEAM = player.Team.Name
	TEAM.TextColor3 = player.TeamColor.Color
	script.givegui.Radio.Frame.L7.Value = script.givegui.Radio.Frame.L6.Value
	script.givegui.Radio.Frame.L6.Value = script.givegui.Radio.Frame.L5.Value
	script.givegui.Radio.Frame.L5.Value = script.givegui.Radio.Frame.L4.Value
	script.givegui.Radio.Frame.L4.Value = script.givegui.Radio.Frame.L3.Value
	script.givegui.Radio.Frame.L3.Value = script.givegui.Radio.Frame.L2.Value
	script.givegui.Radio.Frame.L2.Value = script.givegui.Radio.Frame.L1.Value
	script.givegui.Radio.Frame.L1.Value = player.Name .. "[" .. TEAM .. "]" .. ": " .. ChatFilter:FilterStringAsync(msg, player, player)
end)
1 Like

Theres no possible way to change the color of a “veriable”, there is no such thing as this.

I would assume you mean change the color of the players text?

heres the code.

script.chat.OnServerEvent:Connect(function(player, msg)
	local TEAM = player.Team
	local playerTeamColor = TEAM.TeamColor.Color
	local playerName = player.Name

	-- Set text color to player's team color
	script.givegui.Radio.Frame.L7.TextColor3 = playerTeamColor
	script.givegui.Radio.Frame.L6.TextColor3 = playerTeamColor
	script.givegui.Radio.Frame.L5.TextColor3 = playerTeamColor
	script.givegui.Radio.Frame.L4.TextColor3 = playerTeamColor
	script.givegui.Radio.Frame.L3.TextColor3 = playerTeamColor
	script.givegui.Radio.Frame.L2.TextColor3 = playerTeamColor
	script.givegui.Radio.Frame.L1.TextColor3 = playerTeamColor

	-- Set the text content
	script.givegui.Radio.Frame.L7.Value = script.givegui.Radio.Frame.L6.Value
	script.givegui.Radio.Frame.L6.Value = script.givegui.Radio.Frame.L5.Value
	script.givegui.Radio.Frame.L5.Value = script.givegui.Radio.Frame.L4.Value
	script.givegui.Radio.Frame.L4.Value = script.givegui.Radio.Frame.L3.Value
	script.givegui.Radio.Frame.L3.Value = script.givegui.Radio.Frame.L2.Value
	script.givegui.Radio.Frame.L2.Value = script.givegui.Radio.Frame.L1.Value
	script.givegui.Radio.Frame.L1.Value = playerName .. "[" .. TEAM.Name .. "]" .. ": " .. ChatFilter:FilterStringAsync(msg, player, player)
end)

If you’re using RichText, it would be:

script.chat.OnServerEvent:Connect(function(player, msg)
	local TEAM = player.Team
	local teamColor = TEAM.TeamColor.Color
	script.givegui.Radio.Frame.L7.Value = script.givegui.Radio.Frame.L6.Value
	script.givegui.Radio.Frame.L6.Value = script.givegui.Radio.Frame.L5.Value
	script.givegui.Radio.Frame.L5.Value = script.givegui.Radio.Frame.L4.Value
	script.givegui.Radio.Frame.L4.Value = script.givegui.Radio.Frame.L3.Value
	script.givegui.Radio.Frame.L3.Value = script.givegui.Radio.Frame.L2.Value
	script.givegui.Radio.Frame.L2.Value = script.givegui.Radio.Frame.L1.Value
	script.givegui.Radio.Frame.L1.Value = player.Name .. `<font color="rgb({teamColor.R*255},{teamColor.G*255},{teamColor.B*255})">[` .. TEAM .. "]:</font> " .. ChatFilter:FilterStringAsync(msg, player, player)
	TEAM,teamColor = nil
end)

This should also work too if youre using rich test.

Thank you all very much for trying to help, but other people have already helped.

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