How to see rap on roblox

Help and Feedback Scripting Support

I want to know how to make something like in Trade Hangout where it shows the total amount of rap a player has. But, in order to do this, I learned I had to use This Roblox Api in order to do so. I have no clue about how to incorporate Api into my roblox game. How should I script this? Here is my script now, but it doesn’t show rap;

game.Players.PlayerAdded:Connect(function(player) local stats = Instance.new("Folder",player) stats.Name = "leaderstats" local RAP = Instance.new("IntValue",stats) RAP.Name = "Total RAP" RAP.Value = "?" end)

5 Likes

You can’t use the API endpoints on Roblox using HTTPService, the only way around it is by having a 3rd party web host retrieve the data.

Yes:

  1. Send a GET request to your own web server to get a player’s RAP.
  2. The web server will send a GET request to the Roblox API to collect the data and return it.

No:

  1. Send a GET request to the Roblox API to collect the data and return it.

1 Like

What web server should I use?

30 char

1 Like

You can use any, it’s more of a personal choice based on needs and experience. I use FastComet.

1 Like

Alright, thanks! I think this will work!

You can access the Roblox APIs through rprxy.xyz. This script gets the total RAP of a player through their user id, made for you.

local httpService = game:GetService("HttpService") local function GetTotalRAP(userId) local success, msg = pcall(function() local total = 0 local function CollectRAP(cursor) local url = "//inventory.rprxy.xyz/v1/users/" .. userId .. "/assets/collectibles?sortOrder=Asc&limit=100" if cursor then url = url .. "&cursor=" .. cursor end local data = httpService:GetAsync(url) data = httpService:JSONDecode(data) for i = 1, #data["data"] do pcall(function() total = total + data["data"][i]["recentAveragePrice"] end) end if data["nextPageCursor"] then CollectRAP(data["nextPageCursor"]) end end CollectRAP() return total end) if not success then warn(msg) else return msg end end print(GetTotalRAP(game.Players:GetUserIdFromNameAsync("ForegoingTyler12943"))) -- Example

Let me know of any issues.

6 Likes

Thanks so much for this script! It works nicely by printing out the amount of rap I have, but what if I wanted the amount of player’s rap to be displayed in a screengui? How would I have to modify this script to make it work?

1 Like

Sure, you can set up a simple system where a RemoteFunction is invoked from a LocalScript and the RAP for a player is returned from the server which can be used by the same LocalScript to edit a TextLabel. We do this simply because you can’t use HttpService on the client or else your IP can be stolen.

So what you would do is put this function inside the server script and call it whenever the client requests the RAP of a player.

2 Likes

Help and Feedback Scripting Support

How would I get the player’s RAP from their profile? I’ve been searching for a web endpoint but couldn’t find one.

Edit: To clarify, I’m looking for a web endpoint to retrieve the player’s RAP from the Roblox website for display in a game from a script.

5 Likes

Maybe try adding up the combined RAP of all the items they own?

1 Like

As extension to @EmeraldSlash his suggestion, use this API to get the full list of owned limiteds and add up their RAP.

//inventory.roblox.com/docs#!/Inventory/get_v1_users_userId_assets_collectibles

5 Likes

I have never heard of that website before lol

Cool

There are extensions to see this. However, it would be cool to actually have it built in to a player’s profile on ROBLOX.

1 Like

I edited my thread to clarify my goal. Is there some sort of proxy so I can use the API you provided? I’m fairly certain I can’t access Roblox domains using HTTPService.

That is asked often (a brief search of this forum for ‘roblox proxy’ gets you this as well), but in general it is best to make your own.

This thread lists a few though;

Roblox Catalog Proxy Scripting Support

As what the title says, is there any that i can use?

1 Like

How do I add up the RAP if the roblox API doesn’t show the rap of a limited item?

There’s a recentAveragePrice field in the return you get from this GET API. Have you tried deconstructing the return value you get from a GET request or checking the array’s composition on the endpoint documentation site?

I don’t know how to get the API to work. I currently use http service on the standard roblox catalog api and decode the json data which doesn’t include RAP

Well, that’s probably the first thing you need to start on. Remember that you won’t be able to fetch a user’s collectibles inventory if they’re hidden - something to account for depending on your use case.

The first thing you need to do is send a GET request to the endpoint. Use rprxy, since you can’t directly send requests to Roblox. You must also ensure that Http requests are enabled, either by using the Game Settings tab or setting HttpEnabled to true via the command bar.

local HttpService = game:GetService("HttpService") local UserId = 1 local Endpoint = "//inventory.rprxy.xyz/v1/users/%d/assets/collectibles" local success, result = pcall(HttpService.GetAsync, HttpService, Endpoint:format(UserId))

Once you’ve done this, you can work with the data that’s retrieved. The data returned is in JSON format, so you will need to use JSON decode. Then, simply iterate through the table. This is assuming that the call is successful and returns data.

HttpService:JSONDecode(result) for key, value in pairs(result) do print(key, value) end

If success is false, then the call most likely failed for some reason - such as the endpoint being down or the user’s inventory being hidden. If that’s so, you can check if success is false and print out the error that was received, then handle the rest (e.g. by changing a RAP label to “hidden”).

if not success then warn(result) end

3 Likes

Here’s an implementation I wrote which achieves this.

local http = game:GetService("HttpService") local players = game:GetService("Players") local baseUrl = "//inventory.roproxy.com/v1/users/%d/assets/collectibles?sortOrder=Asc&limit=100&cursor=%s" local function getTotalRecentAveragePriceRecursive(userId, recentAveragePriceCumulative, cursor) recentAveragePriceCumulative = recentAveragePriceCumulative or 0 cursor = cursor or "" local requestUrl = baseUrl:format(userId, cursor) local success, result = pcall(function() return GetAsync(requestUrl) end) if success then if result then local success2, result2 = pcall(function() return JSONDecode(result) end) if success2 then if result2 then for _, collectible in ipairs(result2.data) do if collectible.recentAveragePrice then recentAveragePriceCumulative += collectible.recentAveragePrice end end cursor = result2.nextPageCursor if cursor then return getTotalRecentAveragePriceRecursive(userId, recentAveragePriceCumulative, cursor) else return recentAveragePriceCumulative end end else warn(result2) getTotalRecentAveragePriceRecursive(userId, recentAveragePriceCumulative, cursor) end end else warn(result) getTotalRecentAveragePriceRecursive(userId, recentAveragePriceCumulative, cursor) end end local totalRecentAveragePrice = getTotalRecentAveragePriceRecursive(1) print(totalRecentAveragePrice) --133674592

Toplist

Latest post

TAGs