You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Remove the duplicate values -
What is the issue? Include screenshots / videos if possible!
There is more that one of the same values within the table
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried looking on the forum.
– Product module
local Product = {}
local http = game:GetService("HttpService")
function Product.getUserAssetsRecursive(AssetId, userId, assets, pageNumber, lastLength)
local baseUrl = "https://www.roproxy.com/users/inventory/list-json?assetTypeId="..AssetId.."&cursor=&itemsPerPage=100&pageNumber=%s&userId=%s"
assets = assets or {}
pageNumber = pageNumber or 1
lastLength = lastLength or math.huge
local requestUrl = baseUrl:format(pageNumber, userId)
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 _, asset in ipairs(result2.Data.Items) do
if asset.Creator.Id == userId then
if not table.find(asset,asset.Item.AssetId) then
table.insert(assets, asset.Item.AssetId)
end
end
end
if result:len() ~= lastLength then
lastLength = result:len()
pageNumber += 1
Product.getUserAssetsRecursive(AssetId,userId, assets, pageNumber, lastLength)
end
end
end
end
end
return assets
end
function Product.GetUserCreatedAssets(UserId : number,Assets)
local createdAssets = {}
for _,enum in pairs(Assets) do
local info = Product.getUserAssetsRecursive(enum.Value,UserId)
createdAssets[enum.Name] = info
end
return createdAssets
end
return Product
– Server | boothloader
local ReplicatedStorage = game:GetService(`ReplicatedStorage`)
local Modules = ReplicatedStorage.Modules
local Product = require(Modules.GetProductInfo)
local MarketPlaceService = game:GetService(`MarketplaceService`)
local Players = game:GetService(`Players`)
local AssetsWanted = {Enum.AssetType.GamePass,Enum.AssetType.Shirt,Enum.AssetType.Pants,Enum.AssetType.TShirt}
function PromptPurchase(player,productId,ProductType)
if ProductType == `Gamepass` then
MarketPlaceService:PromptGamePassPurchase(player,productId)
elseif ProductType == `Asset` then
MarketPlaceService:PromptPurchase(player,productId)
end
end
function ListUserProducts(player : Player,Stand)
local data = Product.GetUserCreatedAssets(2233944403,AssetsWanted)
print(data)
for _, gamepass in data[`GamePass`] do
local ProductInfo = MarketPlaceService:GetProductInfo(gamepass,Enum.InfoType.GamePass)
if not ProductInfo.PriceInRobux then continue end
local template = Stand.SignPrices.UI.ScrollingFrame.Template:Clone()
template.Name = gamepass
template.Text = `$ {ProductInfo.PriceInRobux}`
template.Parent = Stand.SignPrices.UI.ScrollingFrame
template.Visible = true
template:SetAttribute(`ProductId`,gamepass)
template.MouseButton1Click:Connect(function()
PromptPurchase(player,gamepass,`Gamepass`)
end)
end
for _, gamepass in data[`Pants`],data[`Shirt`], data[`TShirt`] do
local ProductInfo = MarketPlaceService:GetProductInfo(gamepass,Enum.InfoType.Asset)
if not ProductInfo.PriceInRobux then continue end
local template = Stand.SignPrices.UI.ScrollingFrame.Template:Clone()
template.Name = gamepass
template.Text = `$ {ProductInfo.PriceInRobux}`
template.Parent = Stand.SignPrices.UI.ScrollingFrame
template.Visible = true
template:SetAttribute(`ProductId`,gamepass)
template.MouseButton1Click:Connect(function()
PromptPurchase(player,gamepass,`Asset`)
end)
end
end
for _,proxy in pairs(workspace.Stands:GetDescendants()) do
if proxy:IsA(`ProximityPrompt`) then
proxy.Triggered:Connect(function(player)
if player:GetAttribute(`HasBooth`) then return end
proxy.Enabled = false
player:SetAttribute(`HasBooth`,true)
proxy.Parent.Parent.Values.Owner.Value = player
local Info = proxy.Parent.Parent.SignDescription.SurfaceGui.Frame
Info.OwnerLabel.Text = player.Name
ListUserProducts(player,proxy.Parent.Parent)
end)
end
end