How can I check how much robux a person spent on a in game purchase ( clothes, accessories etc )

I want to check how much robux a person sent when purchasing something so I can add onto a datastore here is my current code, Im sure there was a diffrent event to check however I forgot and cant find anything on it. please lmk if there is something I’m missing!

marketplaceService.PromptPurchaseFinished:Connect(function(player, id, purchased)
	if purchased then
		playerDataHandler:Set(player, "purchases", getPurchases(player) + 1)
		playerDataHandler:Set(player, "robuxSpent", getSpent(player) + 1)
		player:WaitForChild("leaderstats"):WaitForChild("Purchases").Value = getPurchases(player)
	end
end)
1 Like

I recommend you to use DataStore2, it is cleaner, more accurate and without data loss

You seem to be on the right track, You need to save the Amount the Player has spent on the Item in order to get this data as roblox does not directly tell you this.

You can use :GetProductInfo(), and check the PriceInRobux index, and you can take that as your amount to added towards.

The is me Assuming you want to check whether they spent something in your game, rather then All their Purchases on their Account.

1 Like

I am currently using profile service I think that is also good,

Thank you I’m sure this will work!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.