I Don’t Know How to Make It.
local ds = game:GetService("DataStoreService"):GetDataStore("CoinsStats4")
local page = 50
local seconds = 5
local times = seconds
local datasaves = {}
while wait(1) do
times -= 1
script.Parent.Parent.ResetTime.Text = "Resetting in ".. times .." seconds..."
if times <= 0 then
times = seconds
local order = 0
for i,plr in pairs(game.Players:GetChildren()) do
datasaves[plr.UserId] = plr.Rebirths.Value
ds:SetAsync(1,datasaves)
end
for i,leaderboard in pairs(script.Parent:GetChildren()) do
if leaderboard.ClassName == "Frame" then
leaderboard:Destroy()
end
end
datasaves = ds:GetAsync(1)
table.sort(datasaves, function(a, b)
return a < b
end)
for i,v in pairs(datasaves) do
if order < page then
order += 1
local name = game.Players:GetNameFromUserIdAsync(tonumber(i))
local template = script.Template:Clone()
template.LayoutOrder = order
template.Name = name .." Leaderboard"
template.Rank.Text = "#".. order
template.PlrName.Text = name
template.Coins.Text = v
template.Parent = script.Parent
end
end
end
end