Hello! When the player first joins the game it shows how many ugc copies there are. But for some reason it never updates unless they rejoin. Does anyone know why? BTW its a localscript
game:GetService("RunService").RenderStepped:Connect(function()
local MarketplaceService = game:GetService("MarketplaceService")
local assetId = 15406442659
local productInfo = MarketplaceService:GetProductInfo(assetId, Enum.InfoType.Asset)
for k, v in pairs (productInfo) do
if k == "Remaining" then
script.Parent.amt.Text = v.."/100"
end
print(k)
print(v)
end
end)
It looks like you’re just checking for one item in the script you provided. And why does this need to be updated every frame? And what exactly isn’t working?
local marketplaceService = game:GetService("MarketplaceService")
local root = script.Parent
local amount = root:WaitForChild("amt")
local assetId = 15406442659
local function ugcChecker()
while true do
local success, response = pcall(
marketplaceService.GetProductInfo,
marketplaceService,
assetId,
Enum.InfoType.Asset
)
if success then
if response.Remaining then
amount.Text = response.Remaining .. "/100"
end
else
warn(response)
end
task.wait(10) -- Interval
end
end
task.defer(ugcChecker)
Edit 1: Fixed some typos. Try again if it didn’t work.
Im so sorry for the late response(I didnt check my notifications)! Yes it works fine im just not sure if it updates since the ugc is out of stock. Lets just pray that it works! Thank you!