Hey. I am currently making an overhead GUI that gets a user’s collectibles, adds up their RAP and displays a rounded number along with the user’s name. The problem I am encountering is that when a player’s inventory is private, it gives me a HTTP 403 forbidden error and stops the whole function, and doesn’t display an overhead GUI at all. Even if a user’s inventory is private, I want to display his username.
local BillboardGui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
local RAPValue = game:GetService("ServerStorage"):WaitForChild("RAPValue")
local t = 1
game:GetService("StarterPlayer").HealthDisplayDistance = 0
game:GetService("StarterPlayer").NameDisplayDistance = 0
function RoundRAP(Value)
local RAPString = ""
if Value >= 1000000 then
RAPString = ((string.format("%0.1f", tostring(Value/1000000))) .. "M")
return RAPString
elseif Value >= 1000 then
RAPString = ((string.format("%0.1f", tostring(Value/1000))) .. "K")
return RAPString
elseif Value < 1000 then
RAPString = (tostring(Value))
return RAPString
end
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local ClonedGui = BillboardGui:Clone()
local ClonedValue = RAPValue:Clone()
local RAPTable = {}
local HTTP = game:GetService("HttpService")
local ID = game.Players:GetUserIdFromNameAsync(player.Name)
local data = HTTP:GetAsync("https://inventory.rprxy.xyz/v1/users/" .. ID .. "/assets/collectibles", true)
warn(ID)
warn(data)
local DecodedData = HTTP:JSONDecode(data)
local ItemDataTable = (DecodedData["data"])
for i, v in pairs(ItemDataTable) do
local VTable = (ItemDataTable[i])
local RAP = (VTable["recentAveragePrice"])
table.insert(RAPTable, 1, RAP)
end
for i, v in pairs(RAPTable) do
ClonedValue.Value = ClonedValue.Value + v
end
ClonedValue.Parent = ClonedGui
local RAPString = RoundRAP(ClonedValue.Value)
local UserNameString = (tostring(game.Workspace:WaitForChild(player.Name)))
ClonedGui.TextLabel.Text = (UserNameString .. " | " .. RAPString)
ClonedGui.Parent = game.Workspace:WaitForChild(player.Name).Head
local TweeningInfo1 = TweenInfo.new(t , Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local TweenObject = ClonedGui.TextLabel
local Tween1 = game:GetService("TweenService"):Create(TweenObject, TweeningInfo1, {TextColor3 = Color3.new(1, 0, 0)})
local Tween2 = game:GetService("TweenService"):Create(TweenObject, TweeningInfo1, {TextColor3 = Color3.new(1, 1, 0)})
local Tween3 = game:GetService("TweenService"):Create(TweenObject, TweeningInfo1, {TextColor3 = Color3.new(0, 1, 0)})
local Tween4 = game:GetService("TweenService"):Create(TweenObject, TweeningInfo1, {TextColor3 = Color3.new(0, 1, 1)})
local Tween5 = game:GetService("TweenService"):Create(TweenObject, TweeningInfo1, {TextColor3 = Color3.new(0, 0, 1)})
local Tween6 = game:GetService("TweenService"):Create(TweenObject, TweeningInfo1, {TextColor3 = Color3.new(1, 0, 1)})
while true do
Tween1:Play()
wait(t)
Tween2:Play()
wait(t)
Tween3:Play()
wait(t)
Tween4:Play()
wait(t)
Tween5:Play()
wait(t)
Tween6:Play()
wait(t)
end
end)
end)