- What do you want to achieve? Keep it simple and clear!
I want the leaderstat to be saved to my ordereddatastore (CustomersLeaderboard)
I am making a globalleaderboard and the script is in serverscriptservice
The updateleaderboard function works fine
- What is the issue? Include screenshots / videos if possible!
It doesnt write to the datastore, when i do it manually it works, i used
CustomersLeaderboard:SetAsync(12, 100000)
but when i use my auto saving code, it doesnt write, even though it prints the info i need to store
Also, theres noting in the output apart from the info that a printed out in the code below
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Ive searched google multiple times, i can just find unanswered posts, or irrelevant topics.
while wait(10) do
for _, player in pairs(game.Players:GetPlayers()) do
CustomersLeaderboard:SetAsync(player.UserId, player.PlayerStats.TotalCustomers.Value)
print(player.UserId, player.PlayerStats.TotalCustomers.Value)
end
for _, frame in pairs(game.Workspace.CustomersBoard.Board.SurfaceGui.Back.ScrollingFrame:GetChildren()) do
frame:Destroy()
end
updateLeaderboard()
print("Updated!")
end
-- Updateleaderboard function works
-- Problem is on line 3
-- Line 4 prints the info i want to store
P.S I can type properly, i just have a new keyboard