It uses a surface gui and clones a frame and then parents it to teh scrolling frame.
local DataStore = game:GetService("DataStoreService")
local ODS = DataStore:GetOrderedDataStore("MoneyStats")
local Players = game:GetService("Players")
local Scrolling = script.Parent.Leaders
local function cleanboard()
print("Clearing Board | function cleanbaord()")
local Descends = Scrolling:GetChildren()
for i, Descend in pairs(Descends) do
if Descend:IsA("Frame") then
Descend:Destroy()
end
end
end
function updateboard()
local pages = ODS:GetSortedAsync(false, 10)
local CurrentPage = pages:GetCurrentPage()
warn("Update Function Provoked | function updateboard()")
for i, v in ipairs(CurrentPage) do
print({v.key, v.value})
local userId = v.key
local score = v.value
local frame = script.Frame:Clone()
pcall(function()
frame.PName.Text = Players:GetNameFromUserIdAsync(userId)
end)
pcall(function ()
frame.PImage.Image = Players:GetUserThumbnailAsync(userId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
end)
frame.PAmount.Text = "$"..score
frame.PRank.Text = "#"..i
frame.Parent = Scrolling
warn(userId.." is ranked #"..i.." with "..score.."Cash")
end
end
while true do
local success, message = pcall(function()
cleanboard()
task.wait(1)
updateboard()
end)
if not success then
print(message)
end
task.wait(60)
end
it gets to āwarn(āUpdate Function Provoked | function updateboard()ā)ā and stops
I tried and I originally had that, but I believe ipairs is better for loops, I think that is why I originally changed it, I believe I saw that in Documentation.
Its not empty, it loads in to the Leaderstat just fine.
I could understand if it wont work if thereās not enough Keys in the datastore, but I set it to 1 at some point and it still hasnāt come up.
I think you are having the same issue as me, like @shopkinspizzas helped me do, it is supposed to be āGetOrderedDataStoreā instead of āGetDataStore.ā
for that message, the second box of script has no setting and that is only saving, it doesnāt load data either.