Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Dev Product award giver is not working properly?

Asked by
RoyMer 301 Moderation Voter
9 years ago

This is supposed to be giving 25 Gems but it is somehow giving sometimes even 500 gems?? What could the problem be?

This is in the serverscriptservice

stat = "Gems" 
award = 25 
------------------------------------------------------------------------------------------
MarketplaceService = Game:GetService("MarketplaceService")
MarketplaceService.ProcessReceipt = function(receiptInfo)
players = game.Players:GetPlayers()
for i=1,#players do
if players[i].userId == receiptInfo.PlayerId then
players[i].ds[stat].Value = players[i].ds[stat].Value+award
end

wait(1)
end
return Enum.ProductPurchaseDecision.PurchaseGranted 
end

This is in the Gui button

local productId = 25264216 -- Change to the ID of your developer product.
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
    game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)

1 answer

Log in to vote
1
Answered by 9 years ago

Just something, I'll turn the for loop into a generic for loop and see if that fixes anything, feel free to comment if something doesn't go right.


Product

stat = "Gems" 
award = 25 
-----------------------------------------------------------------------------
MarketplaceService = Game:GetService("MarketplaceService")
MarketplaceService.ProcessReceipt = function(receiptInfo)
    for _,plyr in pairs(game:GetService("Players"):GetPlayers()) do
        if plyr.userId == receiptInfo.PlayerId then
            plyr.ds[stat].Value = plyr.ds[stat].Value+award
        end
    end
return Enum.ProductPurchaseDecision.PurchaseGranted 
end

Hope it helps!(Comment if there are any errors)

0
Still gave me 500 :( RoyMer 301 — 9y
Ad

Answer this question