This isn't my first leaderboard, I have 2 others that are working in the background, but I don't know if that affects it.
I'm trying to make global leaderboard that displays the players with the highest points Don't worry about the saving script for the leaderstats, it works fine.
I used this script for all the other global leaderboards that actually work, I just changed some variable names and values.
(Server Script) parented within a part
local DataStoreService = game:GetService("DataStoreService")
local PointsData = DataStoreService:GetOrderedDataStore("PointsV2")
local holder = script.Parent.LeaderboardDisplay.Holder
local resetTime = 120
local numOfPages = script.Parent.Parent.Parent.NumOfPages.Value
local minValue = script.Parent.Parent.Parent.MinValue.Value
local maxValue = script.Parent.Parent.Parent.MaxValue.Value
local function updBoard()
print("Points leaderboard function has run") -- gets printed
local suc, er = pcall(function()
local data = PointsData:GetSortedAsync(false, numOfPages,minValue,maxValue)
local page = data:getCurrentPage()
for rank, data in ipairs(page) do
local getName = game:GetService("Players"):GetNameFromUserIdAsync(tonumber(data.key))
local playerName = getName
local idOfUser = data.key
print("Points leaderboard still didn't break yet") -- not getting printed...
-- code doesn't continue from here...
if rank == 1 then
local npc = script.Parent.Parent.Parent.Podiums.Podium4.Dummy
local config = npc.Configuration
local usernameText = npc.Head.Username.NameText
if npc then
config.userId.Value = idOfUser
usernameText.Text = playerName
end
end
local points = data.value
local isOn = false
for i,v in pairs(holder:GetChildren()) do
if v:IsA("Frame") then
if v.User.TextLabel.Text == playerName then
isOn = true
break
end
end
end
if points > 0 and isOn == false then
print("Points are greater than 0")
local newElement = game:GetService("ReplicatedStorage"):WaitForChild("SampleElement"):Clone()
newElement.User.TextLabel.Text = playerName
newElement.Val.TextLabel.Text = points
newElement.Rank.TextLabel.Text = "#"..rank
newElement.Parent = holder
if newElement.Rank.TextLabel.Text == "#1" then
newElement.User.BackgroundColor3 = Color3.fromRGB(255, 204, 0)
newElement.Val.BackgroundColor3 = Color3.fromRGB(255, 204, 0)
newElement.Rank.BackgroundColor3 = Color3.fromRGB(255, 204, 0)
end
if newElement.Rank.TextLabel.Text == "#2" then
newElement.User.BackgroundColor3 = Color3.fromRGB(202, 202, 202)
newElement.Val.BackgroundColor3 = Color3.fromRGB(202, 202, 202)
newElement.Rank.BackgroundColor3 = Color3.fromRGB(202, 202, 202)
end
if newElement.Rank.TextLabel.Text == "#3" then
newElement.User.BackgroundColor3 = Color3.fromRGB(202, 125, 31)
newElement.Val.BackgroundColor3 = Color3.fromRGB(202, 125, 31)
newElement.Rank.BackgroundColor3 = Color3.fromRGB(202, 125, 31)
end
end
end
end)
if not suc then
warn(er)
end
end
while true do
for _,player in pairs(game:GetService("Players"):GetPlayers()) do
PointsData:SetAsync(player.UserId, player.leaderstats.Points.Value)
end
for _,frame in pairs(holder:GetChildren()) do
if frame:IsA("Frame") then
frame:Destroy()
end
end
updBoard()
wait(resetTime)
end
For some reason, this one doesn't work, it doesn't even print any error in the output, except...
DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key
I tried changing some variable names if they're taken already but that didn't work. I also tried changing the dataStore name maybe I used it already but that didn't work too.

1 comment
It looks like you're sending too many values too quickly.