2 problems with Titles script

The two problems are it doesn’t work. Also I don’t know how to make it so that you get a title if you have a badge you get a title. Anyways heres the script

local Players = game:GetService("Players") -- finding players
local ReplicatedStorage = game:GetService("ReplicatedStorage") --finding replicated storage
local Rank = ReplicatedStorage:FindFirstChild("Rank") -- Find child "Rank" --finding means that its finding a certain child to make it usable
local PlayerRanks = { 
	[2205634843] = {"CREATOR", Color3.fromRGB(78, 116, 255)} -- The main thing with the color
}

function AddRank(player) -- a thing
	if player == nil then return end --if no data for the title is given stop
	
	local displayName = player.DisplayName -- if not do all this
	local clone = Rank:Clone()
	local rankTable = PlayerRanks[player.UserId]
	
	clone.Main.DisplayName.Text = displayName
	
	clone.Main.Title.Text = rankTable[1]
	clone.Main.Title.TextColor = rankTable[2]
	
	clone.Parent = player.Character:WaitForChild("Head") --connecting to head
end

function PlayerAdded(player)
	
	local function CharacterAdded(character)
		
		if PlayerRanks[player.UserId] then
			AddRank(player)
		end
	
	end

	CharacterAdded(player.Character or player.CharacterAdded:Wait())
	player.CharacterAdded:Connect(CharacterAdded)
end

-- Events
Players.PlayedAdded:Connect(PlayerAdded)

for _, player in pairs(Players:GetPlayer()) do
	task.spawn(function()
		PlayerAdded(player)
	end)
end

1 Like