This script is a overhead name script that shows name and color etc. Just wondering if anyone could help me clean it up and how to make it format into my group.

-- Server-side only; use a RemoteFunction to return anything from this script
-- **UNSTABLE**: There may be errors in the compatibility of this script; use F9 and log any errors to a developer!

local GamePassService = game:GetService('GamePassService')

_G.RankManager = {}
_G.RankManagerReady = false

_G.RankManager.GroupId = 2957840
_G.RankManager.HRRank = 12
_G.RankManager.VIPGPId = 0

_G.RankManager.CustomColors = {
	-- ****** URGENT: FOLLOW THE FORMATS OTHERWISE YOU RISK BREAKING THE SCRIPT (NOT 100% COMPATIBLE YET)!!!!!!! ****** --
	Group = {
		-- Format: {RankId, Color3.fromRGB()/Color3.new()},
	},
	Players = {
		-- Format: {Username/UserId, Color3.fromRGB()/Color3.new()},
		{170104962, Color3.fromRGB(255, 100, 0)}, -- TeethyzHolder
		{6220197, Color3.fromRGB(55, 255, 55)}, -- Duscre
		{19089674, Color3.fromRGB(255, 140, 0)}, -- StayClassySanDiego
		{6809102, Color3.fromRGB(85, 0, 255)}, -- colbert2677
		{182905599, Color3.fromRGB(85, 0, 255)}, -- TeethyzDev
		{96382669, Color3.fromRGB(25, 25, 25)}, -- minecrftroxx
		{30489127, Color3.fromRGB(255, 170, 255)}, -- KalaphineAzecti
		{49781650, Color3.fromRGB(255, 0, 0)}, -- lsanitys
	},
}

_G.RankManager.GetRank = function(Player, Arg)
	if Arg == 'Role' then
		return Player:GetRoleInGroup(_G.RankManager.GroupId)
	elseif Arg == 'Rank' then
		return Player:GetRankInGroup(_G.RankManager.GroupId)
	elseif Arg ~= 'Role' and Arg ~= 'Rank' then
		return Player:GetRoleInGroup(_G.RankManager.GroupId)
	end
end

_G.RankManager.SetUpDisplay = function(Player)
	local File = Player:FindFirstChild('leaderstats')
	if not File then
		File = Instance.new('Folder', Player)
		File.Name = 'leaderstats'
	end
	local RankDisplay = Instance.new('StringValue', File)
	RankDisplay.Name = 'Rank'
	RankDisplay.Value = _G.RankManager.GetRank(Player)
end

_G.RankManager.EditRank = function(Player, Arg)
	local File = Player:FindFirstChild('leaderstats')
	if not File then
		warn(Player.Name..' does not have a file to display numbers and strings in.')
	else
		local DisplayedRank = File:WaitForChild('Rank')
		if Arg == 'SRank' then
			DisplayedRank.Value = _G.RankManager.GetRank(Player)
		else
			DisplayedRank.Value = Arg
		end
	end
end

_G.RankManager.SetOverhead = function(Player)
	local MaxCharFindRetries = 5
	local RetriesUsed = 0
	local Character = nil
	repeat
		wait(1)
		Character = Player.Character
		RetriesUsed = RetriesUsed + 1
	until Character ~= nil or RetriesUsed == MaxCharFindRetries
	if Character == nil then
		print(Player.Name..' does not have a character.')
	else
		local RetriesMax = 5
		local Retries = 0
		local Head = nil
		repeat
			wait(1)
			Head = Player.Character:FindFirstChild('Head')
			Retries = Retries + 1
		until Retries == RetriesMax or Head ~= nil
		if Head then
			local NewOverhead = script:WaitForChild('RankGui'):Clone()
			NewOverhead.Parent = Player.Character
			NewOverhead.Adornee = Head
			NewOverhead.Frame.PlayerName.Text = Player.Name
			NewOverhead.Frame.GroupRank.Text = _G.RankManager.GetRank(Player)
			if GamePassService:PlayerHasPass(Player, _G.RankManager.VIPGPId) or _G.RankManager.GetRank(Player, 'Rank') >= _G.RankManager.HRRank then
				NewOverhead.Frame.VIPStatus.Visible = true
			end
			-- DO NOT CHANGE THE ORDER OF COLOR SETTING
			-- Colors based on rank, and if player gets an individual color, it's overwritten by the preceeding function
			for index, pair in pairs(_G.RankManager.CustomColors.Group) do
				if _G.RankManager.GetRank(Player, 'Rank') == pair[1] then
					NewOverhead.Frame.PlayerName.TextColor3 = pair[2]
					NewOverhead.Frame.GroupRank.TextColor3 = pair[2]
				end
			end
			wait()
			for index, pair in pairs(_G.RankManager.CustomColors.Players) do
				if type(pair[1]) == 'number' then
					if Player.UserId == pair[1] then
						NewOverhead.Frame.PlayerName.TextColor3 = pair[2]
						NewOverhead.Frame.GroupRank.TextColor3 = pair[2]
					end
				elseif type(pair[1]) == 'string' then
					if Player.Name == pair[1] then
						NewOverhead.Frame.PlayerName.TextColor3 = pair[2]
						NewOverhead.Frame.GroupRank.TextColor3 = pair[2]
					end
				end
			end
			--NewOverhead.PlayerToHideFrom = Player
			NewOverhead.Enabled = true
		end
	end
end

_G.RankManagerReady = true

4 comments

0

Also note none of the info in it is for my group.

0

Please take this up with the maker of this script, not scriptinghelpers

0

If this was your script, we would've helped you.

0

No, this isn't a request website. We help people come up with solutions to their scripting-related problems, but we do not fix scripts for them.