I'm working on a PlayerPoints shop, where you can buy player points with Robux. For some reason, the script errors out in game. Can anyone figure out what is wrong? Thanks.
local MarketplaceService = game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local points = game:GetService("PointsService")
local twoPoints = 19642067
local fivePoints = 19642318
local tenPoints = 19642331
local fiftyPoints = 19642337
local hundredPoints = 19642339
MarketplaceService.ProcessReceipt = function(receiptInfo)
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == twoPoints then
points:AwardPoints(player.userId, 2)
elseif receiptInfo.ProductId == fivePoints then
points:AwardPoints(player.userId, 5)
elseif receiptInfo.ProductId == tenPoints then
points:AwardPoints(player.userId, 10)
elseif receiptInfo.ProductId == fiftyPoints then
points:AwardPoints(player.userId, 50)
elseif receiptInfo.ProductId == hundredPoints then
points:AwardPoints(player.userId, 100)
end
end
end
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId
ds:IncrementAsync(playerProductKey, 1)
return Enum.ProductPurchaseDecision.PurchaseGranted
end

6 comments
Maybe it's because I was using game.Players:GetChildren() instead of game.Players:GetPlayers()? Would that affect it at all?
I am also using GetChildren() and it works fine other than receiving multiple weapons... Here is what I can think of- Do you have a LocalScript inside StarterPack? If so, what does that LocalScript contain?
I have multiple local scripts inside of the StarterGui, which prompt the players to buy the developer products.
In that case, are you prompted to purchase them?
What do you mean? :P
When you perform whatever action that is required to call PromptProductPurchase, are you prompted to purchase the Dev Product?