Custom leaderboard not displaying Player name or Stats

I developed a custom leaderboard to expand the design of my game, but there has been a few problems It won’t display the player name or stats, just the template

--\\ Variables //--

local Players = game:GetService("Players")
local PlayerList = script.Parent:WaitForChild("PlayerList")
local TopFrame = script.Parent:WaitForChild("TopFrame")
local Item = game:GetService("ReplicatedStorage"):WaitForChild("Template")
local MarketplaceService = game:GetService("MarketplaceService")
local Tween = game:GetService("TweenService")
local Position = UDim2.new(0.066, 0, 0.015, 0)
local Triggered = false
--\\ Main Script //--

game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)

function UpdatePosition() -- Repositions the other names not deleted
	local Position = UDim2.new(0.066, 0, 0.015, 0)
	for i,v in pairs(PlayerList) do
		v.Position = Position
		Position = Position + UDim2.new(0, 0, 0.118, 0)
	end
end


game.Players.ChildAdded:Connect(function(Child) -- New name created
	print("Loading player info for new player")
	local New = Item:Clone()
	local Color = Item.Color
	local PlayerName = Item.PlrName
	local PlayerData = Item.PlrData
	New.Parent = PlayerList
	New.Name = Child.Name
	New.Position = Position
	Position = Position + UDim2.new(0, 0, 0.118, 0)
	Color.Name = "Color"
	Color.AnchorPoint = Vector2.new(0, 1)
	Color.BackgroundColor3 = Color3.new(1, 1, 1)
	Color.BorderSizePixel = 0
	Color.Position = UDim2.new(0, 0, 1, 0)
	Color.Size = UDim2.new(1, 0, 0, 2)
	PlayerName.BackgroundColor3 = Color3.new(1, 1, 1)
	PlayerName.BackgroundTransparency = 1
	PlayerName.Position = UDim2.new(0.047, 0, 0, 0) 
	PlayerName.Size = UDim2.new(0.573, -25, 1, 0)
	PlayerName.Font = Enum.Font.SourceSansSemibold
	PlayerName.Text = New.Name
	PlayerName.TextColor3 = Color3.new(1, 1, 1)
	PlayerName.TextScaled = true
	PlayerName.TextXAlignment = Enum.TextXAlignment.Left
	PlayerData.BackgroundColor3 = Color3.new(1, 1, 1)
	PlayerData.BackgroundTransparency = 1
	PlayerData.Position = UDim2.new(0, 174, 0, 0) 
	PlayerData.Size = UDim2.new(0.429, -25 ,1, 0)
	PlayerData.Font = Enum.Font.SourceSansSemibold
	PlayerData.TextColor3 = Color3.new(1, 1, 1)
	PlayerData.TextScaled = true
	PlayerData.TextXAlignment = Enum.TextXAlignment.Center
	
	
	New.MouseEnter:Connect(function()
		Tween:Create(Color, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(80, 80, 255)}):Play()
		Tween:Create(PlayerName, TweenInfo.new(0.2), {TextColor3 = Color3.fromRGB(80, 80, 255)}):Play()
	end)
	
	New.MouseLeave:Connect(function()
		Tween:Create(Color, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(255, 255, 255)}):Play()
		Tween:Create(PlayerName, TweenInfo.new(0.2), {TextColor3 = Color3.fromRGB(255, 255, 255)}):Play()
	end)
	
end)
















for i,v in pairs(game.Players:GetChildren()) do
	print("Loading player info for new player")
	local New = Item:Clone()
	local Color = Item.Color
	local PlayerName = Item:WaitForChild("PlrName")
	local PlayerData = Item:WaitForChild("PlrData")
	New.Parent = PlayerList
	New.Name = v.Name
	New.Position = Position
	Position = Position + UDim2.new(0, 0, 0.118, 0)
	Color.Name = "Color"
	Color.AnchorPoint = Vector2.new(0, 1)
	Color.BackgroundColor3 = Color3.new(1, 1, 1)
	Color.BorderSizePixel = 0
	Color.Position = UDim2.new(0, 0, 1, 0)
	Color.Size = UDim2.new(1, 0, 0, 2)
	PlayerName.BackgroundColor3 = Color3.new(1, 1, 1)
	PlayerName.BackgroundTransparency = 1
	PlayerName.Position = UDim2.new(0.047, 0, 0, 0) 
	PlayerName.Size = UDim2.new(0.573, -25, 1, 0)
	PlayerName.Font = Enum.Font.SourceSansSemibold
	PlayerName.Text = New.Name
	PlayerName.TextColor3 = Color3.new(1, 1, 1)
	PlayerName.TextScaled = true
	PlayerName.TextXAlignment = Enum.TextXAlignment.Left
	PlayerData.BackgroundColor3 = Color3.new(1, 1, 1)
	PlayerData.BackgroundTransparency = 1
	PlayerData.Position = UDim2.new(0, 174, 0, 0) 
	PlayerData.Size = UDim2.new(0.429, -25 ,1, 0)
	PlayerData.Font = Enum.Font.SourceSansSemibold
	PlayerData.TextColor3 = Color3.new(1, 1, 1)
	PlayerData.TextScaled = true
	PlayerData.TextXAlignment = Enum.TextXAlignment.Center
	
	
	New.MouseEnter:Connect(function()
		Tween:Create(Color, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(80, 80, 255)}):Play()
		Tween:Create(PlayerName, TweenInfo.new(0.2), {TextColor3 = Color3.fromRGB(80, 80, 255)}):Play()
	end)
	
	New.MouseLeave:Connect(function()
		Tween:Create(Color, TweenInfo.new(0.2), {BackgroundColor3 = Color3.fromRGB(255, 255, 255)}):Play()
		Tween:Create(PlayerName, TweenInfo.new(0.2), {TextColor3 = Color3.fromRGB(255, 255, 255)}):Play()
	end)
end


game.Players.ChildRemoved:Connect(function(Child) -- Removes the name
	PlayerList[Child.Name]:Destroy()
	UpdatePosition()
end)

There is a template in replicated storage which is cloned to put the Player’s name on and the data

Prints:

1 Like

I have fixed the issue that I had