Hi, I have sort of merged two scripts together so I know it might make no sense. I’m getting this error, any idea how I can fix it?
’ ServerScriptService.Arena1Script:216: attempt to index number with ‘price’ ’
local function getUserGeneratedTShirtsRecursive(username, tshirts, cursor)
tshirts = tshirts or {}
cursor = cursor or ""
local requestUrl = baseUrl:format(username, cursor)
local success, result = pcall(function()
return http:GetAsync(requestUrl)
end)
if success then
if result then
local success2, result2 = pcall(function()
return http:JSONDecode(result)
end)
if success2 then
if result2 then
for _, tshirt in ipairs(result2.data) do
table.insert(tshirts, tshirt.id)
end
cursor = result2.nextPageCursor
if cursor then
return getUserGeneratedTShirtsRecursive(username, tshirts, cursor)
else
return tshirts
end
end
else
warn(result)
end
end
else
warn(result)
end
end
winner.PlayerGui.Donation.Enabled = true
local username = winner.Name
local userTShirts = getUserGeneratedTShirtsRecursive(username)
print(#userTShirts) --3
print(table.concat(userTShirts, " ")) --1031862 1036727 1031864
game.ReplicatedStorage.RemoteEvent:FireClient(winner)
winner.PlayerGui.Donation.Frame.TextLabel.Text = "Donate to".. winner.Name
table.sort(userTShirts,
function(a,b)
return a.price < b.price
end
)
for i, item in pairs(userTShirts) do
local newButton = script.DonateButton:Clone()
newButton.Text = item.price .. "R$"
local id = Instance.new("IntValue", newButton)
id.Value = item.id
newButton.Parent = winner.PlayerGui.Donation.Frame.itemsScroller
end
I’d really appreciate any help, thanks.