My problem is, when I play the game, the output says "Updated" but when I change the value of points, it does not change it on the leaderboard as it should
local DataStoreService = game:GetService("DataStoreService")
local PointsLeaderboard = DataStoreService:GetOrderedDataStore("PointsLeaderboard")
local function updateLeaderboard()
local success, errorMessage = pcall (function()
local Data = PointsLeaderboard:GetSortedAsync(false, 5)
local PointsPage = Data:GetCurrentPage()
for Rank, data in ipairs(PointsPage) do
local userName = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
local Name = userName
local Points = data.value
local isOnLeaderboard = false
for i, v in pairs(game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
if v.Player.Text == Name then
isOnLeaderboard = true
break
end
end
if Points and isOnLeaderboard == false then
local newLbFrame = game.ReplicatedStorage:WaitForChild("LeaderboardFrame"):Clone()
newLbFrame.Player.Text = Name
newLbFrame.Points.Text = Points
newLbFrame.Rank.Text = "#"..Rank
newLbFrame.Position = UDim2.new(0, 0, newLbFrame.Position.Y.Scale + (.08 * #game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()), 0)
newLbFrame.Parent = game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder
end
end
end)
if not success then
print(errorMessage)
end
end
while true do
for _, player in pairs(game.Players:GetPlayers()) do
PointsLeaderboard:SetAsync(player.UserId, player.leaderstats.Points.Value)
end
for _, frame in pairs (game.Workspace.GlobalLeaderboard.LeaderboardGUI.Holder:GetChildren()) do
frame:Destroy()
end
updateLeaderboard()
print("Updated!")
wait(10)
end

4 comments
Make sure you are changing the values on the server rather than the client
What if that still does not work?
I'm not sure what the main goal of the script is. I can see that you want to load data from a DataStore but what is the rest of the script for?
The rest of the script is placing that data on to a leaderboard