OverHead Ranks with Colors

Hello, I have tried for hours and hours trying to fix this. I have code that when I join the game it SHOULD change the color of the over head rank UI to a predefined color, but it doesnt. I have attachments below! If anyone can help I’d be so happy! Thanks so much!

Code:

local RankUi = game.ServerScriptService.GroupRank.RankUI
local PLRS = game:GetService(“Players”)
print(‘Got Player Service’)
local GroupID = 5391088
print(‘RanLine1’)

PLRS.PlayerAdded:Connect(function(player)
player.CharacterAppearanceLoaded:Connect(function(char)
print(‘1’)
local newRankUi = RankUi:Clone()
newRankUi.Parent = char
print(‘2’)
local groupRank = player:GetRoleInGroup(GroupID)
print(‘RanLine2’, GroupID, groupRank)

	newRankUi.GroupRank.Text = groupRank
	-- Check group rank and set text color accordingly
	if groupRank == 1 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(0, 0, 0) -- Recruit
	elseif groupRank == 2 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(217, 212, 182) -- VIP
	elseif groupRank == 3 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(223, 216, 153) -- Receptionist
	elseif groupRank == 4 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(79, 89, 113) -- Security
	elseif groupRank == 5 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(173, 142, 137) -- Overseer
	elseif groupRank == 6 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(92, 146, 222) -- Trainer
	elseif groupRank == 7 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(138, 95, 168) -- Assistant
	elseif groupRank == 8 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(202, 133, 67) -- Consultant
	elseif groupRank == 9 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(144, 52, 47) -- Cafe Worker
	elseif groupRank == 10 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(135, 217, 193) -- Ambassador
	elseif groupRank == 11 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(119, 243, 75) -- Advisor
	elseif groupRank == 12 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(97, 87, 77) -- Ranker
	elseif groupRank == 13 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(228, 82, 179) -- Manager
	elseif groupRank == 14 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(220, 186, 75) -- Guard
	elseif groupRank == 15 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(211, 136, 66) -- Protector
	elseif groupRank == 16 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(227, 63, 53) -- Lord
	elseif groupRank == 17 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(80, 114, 238) -- Clown
	elseif groupRank == 18 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(210, 113, 243) -- Proxy
	elseif groupRank == 19 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(224, 92, 83) -- Angelical
	elseif groupRank == 20 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(161, 226, 130) -- Head of Management
	elseif groupRank == 21 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(233, 188, 183) -- Monarch
	elseif groupRank == 254 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(0, 0, 0) -- Developer
		print('Changed Color to Black')
	elseif groupRank == 255 then
		newRankUi.GroupRank.TextColor3 = Color3.fromRGB(229, 194, 69) -- King
		print('Changed Color')
	end

	newRankUi.Parent = char:WaitForChild("Head")
end)

end)

image

This is some very inefficient code, perhaps look for an open source alternative - There are many overhead rank solutions that are made very efficient. Let me know if you need any help looking for them.

2 Likes

Welcome to Cookie Tech!

This may seem inefficient, try using functions instead and make it activate when a player joins the game.

Yes, Please! This would be a big help!

You can use my overhead system!

Thanks, but I need each rank to be a diffrent color

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