Description:
I need a script that gives me the userids of the top 3 people in the monthly leaderboard of playerpoints.
I expect it to use HTTPService not datastores.
Payment:
I pay you whatever sum you think is fair. Feel free to decide the price before starting to code.
I will pay after receiving and testing the product to make sure it works.
Just use an OrderedDatastore. Save the userId as key and points (or whatever you want to order) as value to it, and then pull the top entries out of that datastore. I could write you the script if you really canât figure it out yourself, but I wouldnât take any money for it, itâs really simple.
Didnât know such thing existed
I tried to make my own with regular datastores but it was a hazzle.
Issue is tho:
I would need to delete the whole list after 1 month, but the previous months players would still appear first on the leaderboard on the webpage. I could delete their points when they login to the game again but if they donât play, they will stay on the leaderboard until they play the game again.
This non-synced issue would be a real trouble for people trying to see how much pp they need to be on top.
I havenât used OrderedDataStores much, but I assume you could save something like this:
{SCORE,TIME} â where time = tick()
in that way, you could auto-delete values that exceed the max amount of time from X-date.
You want two sorted datastores: Once which associates UserIds with player points, and another which associates userIds with the timestamp of the last time they joined a server. Every few hours, iterate through the timestamp datastore, starting from the back and working forward. If (time_now - time_lastLogin) < (seconds per month) , then you know that their records need to be stricken from the points datastore and they need to be moved to the front of the login datastore:
if currentTimestamp - lastLoginTimestamp < 2.628e6 then
PointsDS:SetAsync(userId, 0)
LastLoginDS:SetAsync(userId, math.huge)
PointsService:AwardPoints(userId, -PointsService:GetGamePointBalance(userId))
else
break
end
It should also stop checking players when it comes across someone who has logged in within the past month.
PointsDS now reflects your current monthly leaders:
local leaders = PointsDS:GetSortedAsync(true, 3)
Itâs up to you to to keep the points datastore synced to the values on the website.
I appreciate you taking time to write that code but itâs not going to work.
Now I need to reset the leaderboard and updating 2 datastore tables and 1 playerpoint list is just too much.
I could figure it out for you using HttpService, but I need to know what game itâs for exactly for the API calls. Unfortunately itâs not something as simple as the place ID it seems, but Iâd have to take a closer look.
Youâll also need to set up your own proxy so that you can fetch the contents of ROBLOX.com APIs.