for my clan system i got a idea so player can buy a subsription and with that subscription they can chose an image out thier inventory and place that as clan logo but it images dont load
i did in the script make the same structure as printed out but the script doesnt work
local HttpService = game:GetService("HttpService")
-- UI Components
local inventoryUI = script.Parent.Parent.images
local template = script.Parent.template.imgtemp
local function fetchPlayerImages(userId)
local apiUrl = "https://www.roproxy.com/users/inventory/list-json?assetTypeId=13&cursor=&itemsPerPage=50&pageNumber=&userId=" .. userId
local success, response = pcall(function()
return HttpService:GetAsync(apiUrl)
end)
if success then
local data = HttpService:JSONDecode(response)
print(data)
return data.Data or {}
else
warn("Failed to fetch player images from RoProxy:", response)
return {}
end
end
local function populateUI(data)
if data and data.Data and data.Data.Items then
for _, imageInfo in ipairs(data.Data.Items) do
local item = imageInfo.Item
if item then
local assetId = item.AssetId
local name = item.Name
print("AssetId:", assetId)
print("Name:", name)
local newUI = template:Clone()
newUI.Parent = inventoryUI
newUI.Visible = true
newUI.bimg.Image = "rbxassetid://" ..assetId
newUI.dtitle.Text = name
newUI.trigger.trigger.MouseButton1Click:Connect(function()
-- Apply Image ID to selected instances
local selectedInstances = Selection:Get()
for _, instance in pairs(selectedInstances) do
if instance:IsA("ImageLabel") then
instance.Image = "rbxassetid://" .. assetId
elseif instance:IsA("Decal") then
instance.Texture = "rbxassetid://" .. assetId
end
end
print("Applied Image ID:", assetId, "to selected instances.")
end)
end
end
end
end
local function start()
local images = fetchPlayerImages(userId)
populateUI(images)
end
start()
the user id works but the clone and fill in data doesnt work