Currently I am making a World Records leaderboard but my ordered datastores do not seem to be picking up any saved values inside of them (There is because saves works). Is this due to me saving in a different script and then doing leaderboards in a different script? Heres the code I’d much appreciate any help:
local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local TimeRecordBoard = game.Workspace.TimeLeaderBoard:WaitForChild("Display"):WaitForChild("WorldRecords")
for i, frame in pairs(TimeRecordBoard.Frames:GetChildren()) do
local dataStore = DataStoreService:GetOrderedDataStore(frame.Name)
local success, errormessage = pcall(function()
local Data = dataStore:GetSortedAsync(true, 50)
local Page = Data:GetCurrentPage()
for rank, data in ipairs(Page) do
print("Found a player")
local Username = Players:GetNameFromUserIdAsync(tonumber(data.key))
local Time = data.Value
if Time then
local newFrame = frame:FindFirstChild("Template"):Clone()
newFrame.UserName.Text = Username
newFrame.Rank.Text = "#"..rank
newFrame.Time.Text = tostring(Time)
newFrame.Parent = frame
newFrame.LayoutOrder = rank
newFrame.Visible = true
newFrame.Name = Username
else
print("No time was found")
end
end
end)
if not success then
print(errormessage)
elseif success then
print("Succesfully did leadeerboards")
end
end
Successfully did leaderboards prints 8 times each time showing it’s working for each map. Found a player does not print though even though my saves should be on there.