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)
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 PriceInRobuxindex, 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.