I'm trying to get the total of robux spent on my gamepasses

MarketplaceService:GetProductInfo().Sales returns 0 In game?

Studio:
Studio
InGame:
Game

local Gamepasses = {
	[1] = 218170241,
	[2] = 218180369,
}
local TotalRobux = 0

for Number, Pass in pairs(Gamepasses) do
	local Info = MarketplaceService:GetProductInfo(Pass, Enum.InfoType.GamePass)
	if Info then
		local Sales = Info.Sales
		local PriceInRobux = Info.PriceInRobux
		print("Sales", Sales)
		print("PriceInRobux", PriceInRobux)
		if Sales and PriceInRobux then
			TotalRobux += (Sales * PriceInRobux)
			print("TotalRobux", TotalRobux)
		end
	end
end
3 Likes

I also recommend that you convert the script to webhook for discord, so it’s easier to look at the totalrobux spent

2 Likes

Rest assured that this Service does what is required.

I believe what has you mistaken is your method of testing the increase. You see, when you purchase the gamepass within studio in a testing environment, it has the advantage of not taking your ROBUX away. However, this does not actually go to the server, hence no receipt is printed. I would check if

game:GetService("RunService"):IsStudio()

is set to true and manually increase it for testing purposes. I would recommend this method due to the redundance of spending ROBUX on your own game pass to register it to the system.

Let me know if that fixes your issue. :grinning:

2 Likes

I recommend this as well. However be careful not to spam it as you may get Webhook blacklisted!

1 Like

If it went through it would’ve showed up prior to all of this… Are you sure you didn’t do it in studio?

That is correct. If you leave the game or the process fails before the purchase is complete, the purchase is voided. Check the alt account’s inventory to see if the purchase came through.

That would be the verdict. Allow it time to process and confirm it. That is when a sale is truly completed.

I tested it out in one of my games where I know for a fact that several thousand people have purchased gamepasses, and it still gives a result of 0.
It’s possible that it’s a studio exclusive thing, or maybe just bugged. Waiting for it to be finish being pending will have no effect on it.

Alrighty then… Yeah that may be a server side issue then. I’d suggest waiting a day @sopkhim @SeargentAUS and if it still doesn’t work, file a report to the software engineers. Could be a fast flag that’s being switched off for testing momentarily. I will check in the morning to see if there’s anything like that going on.

Worst case scenario there is most likely an API that will let you get that information with a token.