You can write a function to get the RAP with Roblox endpoints (like Sparks said).
You will have to use a proxy (such as rprxy.xyz) but it's not a big problem.
Let's start one-by-one
local Website = "https://inventory.rprxy.xyz/v1/users/%u/assets/collectibles?sortOrder=Asc&limit=100&cursor=%s"
Set the website to https://inventory.roblox.com/v1/users/{userId}/assets/collectibles and replace "roblox.com" with "rprxy.xyz". We also set the sortOrder to ascending and the limit to 100
local Website = "https://inventory.rprxy.xyz/v1/users/%u/assets/collectibles?sortOrder=Asc&limit=100&cursor=%s"
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
Get HttpService and Players
function CalculateRAP(Player)
local Cursor = ""
local UserID = 80254
local Running = true
local Data
local JSONData
local RAP = 0
local StartTime = os.time()
local EndTime
end
Define the function with variables. In this case, there is no cursor, UserID is Stickmasterluke's, His current RAP is 0, and the StartTime is now
local Website = "https://inventory.rprxy.xyz/v1/users/%u/assets/collectibles?sortOrder=Asc&limit=100&cursor=%s"
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
function CalculateRAP(Player)
local Cursor = ""
local UserID = 80254
local Running = true
local Data
local JSONData
local RAP = 0
local StartTime = os.time()
local EndTime
while Running do
JSONData = HttpService:GetAsync(string.format(Website, UserID, Cursor))
Data = HttpService:JSONDecode(JSONData)
end
end
While the code is running, the JSON data is requested from https://inventory.rprxy.xyz/v1/users/%u/assets/collectibles?sortOrder=Asc&limit=100&cursor=%s, whereas %u is replaced with the UserID and %s is replaced by Cursor
local Website = "https://inventory.rprxy.xyz/v1/users/%u/assets/collectibles?sortOrder=Asc&limit=100&cursor=%s"
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
function CalculateRAP(Player)
local Cursor = ""
local UserID = 80254
local Running = true
local Data
local JSONData
local RAP = 0
local StartTime = os.time()
local EndTime
while Running do
JSONData = HttpService:GetAsync(string.format(Website, UserID, Cursor))
Data = HttpService:JSONDecode(JSONData)
for Index,Item in pairs(Data.data) do
if Item.recentAveragePrice then
print(string.format("Current RAP: %u. RAP of %s: %u.", RAP, Item.name, Item.recentAveragePrice))
RAP = RAP + Item.recentAveragePrice
else
Running = false
end
wait()
end
end
end
Loops through all items in the page and sums up their RAP. Notice that this will get 100 items at maximum...
local Website = "https://inventory.rprxy.xyz/v1/users/%u/assets/collectibles?sortOrder=Asc&limit=100&cursor=%s"
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
function CalculateRAP(Player)
local Cursor = ""
local UserID = 80254
local Running = true
local Data
local JSONData
local RAP = 0
local StartTime = os.time()
local EndTime
while Running do
JSONData = HttpService:GetAsync(string.format(Website, UserID, Cursor))
Data = HttpService:JSONDecode(JSONData)
for Index,Item in pairs(Data.data) do
if Item.recentAveragePrice then
print(string.format("Current RAP: %u. RAP of %s: %u.", RAP, Item.name, Item.recentAveragePrice))
RAP = RAP + Item.recentAveragePrice
else
Running = false
end
wait()
end
if Data.nextPageCursor then
Cursor = Data.nextPageCursor
wait()
else
Running = false
end
end
end
... so we will need a page cursor! If the next page exists, flip to the next page. Otherwise, stop running.
And finally:
local Website = "https://inventory.rprxy.xyz/v1/users/%u/assets/collectibles?sortOrder=Asc&limit=100&cursor=%s"
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
function CalculateRAP(Player)
local Cursor = ""
local UserID = 80254
local Running = true
local Data
local JSONData
local RAP = 0
local StartTime = os.time()
local EndTime
while Running do
JSONData = HttpService:GetAsync(string.format(Website, UserID, Cursor))
Data = HttpService:JSONDecode(JSONData)
for Index,Item in pairs(Data.data) do
if Item.recentAveragePrice then
print(string.format("Current RAP: %u. RAP of %s: %u.", RAP, Item.name, Item.recentAveragePrice))
RAP = RAP + Item.recentAveragePrice
else
Running = false
end
wait()
end
if Data.nextPageCursor then
Cursor = Data.nextPageCursor
wait()
else
Running = false
end
end
local EndTime = os.time()
print(string.format("%s has %u RAP. That took %u seconds!", Player.Name, RAP, EndTime - StartTime))
end
Players.PlayerAdded:Connect(CalculateRAP)
Connect it to the event PlayerAdded and output how long it took.
2 comments
you can use roblox's api website
No you can't. It will filter