Question: How can I make this
local UserId = 1
into where whenever a player joins their RAP gets set.
How do I also set the TotalRAP val into a int value?
This is what I got
local HttpService = game:GetService("HttpService")
local UserId = 1 --// UserId of the person you want to find the RAP of
local URL = string.format("https://inventory.rprxy.xyz/v1/users/%d/assets/collectibles?sortOrder=Asc&limit=100", UserId)
local Data = HttpService:GetAsync(URL) --// Send a GET request to the proxy
local DecodedData = HttpService:JSONDecode(Data) --// Make the data into a valid Lua table
local TotalRAP = 0
for _, Item in ipairs(DecodedData.data) do --// Iterate through and add each item's RAP
TotalRAP = TotalRAP + Item.recentAveragePrice
end
I am also getting some output errors on Line 5 Which is -
ServerScriptService.RAPHttp:5: bad argument #2 to 'format' (number expected, got nil)