I feel like this is going to be trivial question, definitely going to be solved relatively quick (or not), since it’s about optimization. But i have a quick question regarding best way to use MarketplaceService:GetProductInfo()
Im currently making a browser game. Suppose i have array of game ID, like so :
local example_gameId : {
104124,
124012,
49593,
089713
}
And i need to get their product info for every game ID in the array. In case of cheaper network cost approach, how should i manage the ProductInfo retreival. Should i give the task to server to retrieve every product info, and cache it and distribute to client through remote event when they need it. Or should i let client retrieve the product info by themself?
You can use both local and server to get ProductInfo of an ID
Here’s an example:
local example_gameId = {
{ID = 104124, data = nil},
{ID = 124012, data = nil},
{ID = 49593, data = nil},
{ID = 089713, data = nil}
}
for n, array in ipairs(example_gameId) do
local id = array.ID
spawn(function()
local d
local s,e = pcall(function()
d = game:GetService("MarketplaceService"):GetProductInfo(id)
end)
if not s then warn(e) return end
array.data = d
end)
end
Im very aware that both client and server can call GetProductInfo(). Im asking which method provide cheaper and less strain in network cost for the client.
That’s too bad. But the link you gave. does give additional information that server side is better for handling it (atleast for my case), since server can only call ProductInfo() once and cache. Then distribute it to client when they asked for it.