Is there a way to get the price of a developer product?

The way I’ve set up my gui shop feels kind of messy. Currently every time I change the price on a product, I have to go through my gui and change the textlabels text to the new price that it is. Is there a better way to do this?

You can use MarketplaceService:GetProductInfo() and update it based on the cost.

1 Like

https://developer.roblox.com/en-us/api-reference/function/MarketplaceService/GetDeveloperProductsAsync

Would arguably be more suitable.

local marketplace = game:GetService"MarketplaceService"
local getDeveloperProducts = marketplace.GetDeveloperProductsAsync

local function _getDeveloperProducts() : table
	local developerProducts = {}
	local success, result = pcall(getDeveloperProducts, marketplace)
	if success then
		if result then
			local developerProductsPage = result:GetCurrentPage()
			repeat
				for _, developerProductItem in ipairs(developerProductsPage) do
					for _, developerProductField, developerProductValue in pairs(developerProductItem) do
						developerProducts[developerProductField] = developerProductValue
					end
				end
				
				if not result.IsFinished then
					developerProductsPage:AdvanceToNextPageAsync()
				end
			until result.IsFinished
		end
	else
		warn(result)
	end
	return developerProducts
end

local developerProducts = _getDeveloperProducts()
for developerProductField, developerProductValue in pairs(developerProducts) do
	print(developerProductField, developerProductValue)
end
3 Likes