[PAID] Script: Get leaderboard top 3 (monthly)

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.

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.

1 Like

Didn’t know such thing existed :stuck_out_tongue:
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.

Yes but the issue is that the leaderboard shown on roblox webpage will not reset.
The datastore and webpage leaderboard won’t be the same.

I’m not entirely sure how scopes work, but you could get the OrderedDataStore under the scope of Year…Month

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))

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 updated the thread description.

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.

I figured it uses a proxy, but idk how to setup that kind of stuff…
How much you want to do it all?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.