Custom leaderboard script modification help needed

Hello, I tried to make a Custom leaderboard by watching a video it succeded but I need some modifications.

First modification:
– The player’s nickname should appear not the real name
–Example: it should not appear superkingburger1456. It should appear Burger

Second modification:
– A leaderstats value should be displayed
–Example: Superkingburger1456 30 Coins

Script inside of PlayerListUI:
image

Script contents:

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

local function temp (player)
	local frame = game.ReplicatedStorage.Template:Clone()
	frame.Parent = script.Parent.Frame.ScrollingFrame
	frame.Name = player.Name
	frame.name.Text = player.Name
	frame.Visible = true
end

game.Players.PlayerAdded:Connect(function(plr)
	temp(plr)
end)

for _,players in pairs(game.Players:GetChildren()) do
	temp(players)
end

game.Players.PlayerRemoving:Connect(function(plr)
	for i,v in pairs(script.Parent.Frame.ScrollingFrame:GetChildren()) do
		if v.Name and plr.Name then
			v:remove()
		end
	end
end)

Please do help me as this is for my game. Thanks :slight_smile:

plr.DisplayName will give you their nickname. If they don’t have a display name then it will be there name. the second part you would do plr.Name…" “…myCoin.Value…” Coins"
change myCoin to whatever the variable/or directory index is for the leaderstat “Coins”

1 Like

Thanks for the reply but could you specify which line should we put it below of?

Is this a global leaderboard or server?

1 Like

Yeah this is a server leaderboard. It should the player’s name and his/her leaderstats value in the side

So should we make it like:

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

local function temp (player)
local frame = game.ReplicatedStorage.Template:Clone()
frame.Parent = script.Parent.Frame.ScrollingFrame
frame.Name = player.DisplayName
frame.name.Text = player.Name…""…player.leaderstats.Coins.Value…“Coins”
frame.Visible = true
end

game.Players.PlayerAdded:Connect(function(plr)
temp(plr)
end)

for _,players in pairs(game.Players:GetChildren()) do
temp(players)
end

game.Players.PlayerRemoving:Connect(function(plr)
for i,v in pairs(script.Parent.Frame.ScrollingFrame:GetChildren()) do
if v.Name and plr.Name then
v:remove()
end
end
end)

frame.name.Text = player.Name.." "..player.leaderstats.Coins.Value..“ Coins”

also another issue with your code is that you are applying a frame for yourself twice, You only need to do getchildren() you don’t need playeradded

1 Like

Yea thanks I did that and it worked:
image
Thanks for the help by the way.This was for my friend’s game