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:
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)
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”
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)