Okay, I am trying to make a player points store, original, yes I know. I'm broke though so, aha. I'm trying to have it where when you click the button, it brings up the purchase, then rewards points after the points are purchased.
Could you help me with the code? Here is on for the script:
local buyButton = script.Parent
local productId = 19714128
local Player = script.Parent.Parent.Parent.Parent.Parent
Type = 0
if Player.Name == "Asirix" then Type = 2 else Type = 0 end
buyButton.MouseButton1Click:connect(function()
Game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId, false, Type)
end)
local MarketplaceService = Game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
MarketplaceService.ProcessReceipt = function(receiptInfo)
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == productId then
local pointsToAward = PointsService:GetAwardablePoints()
local universeBalance = PointsService:GetGamePointBalance(player.userId)
if ( pointsToAward > 0 and universeBalance == 0) then
PointsService:AwardPoints(player.userId, 10)
end
end
end
end
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId
ds:IncrementAsync(playerProductKey, 1)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
I need help, this is a local script under a gui button.

1 comment
Yes, but will this also reward player points?