I have 4 item in my developer item store right now. In game, when I click the store button the GUI pops up and everything looks fine. When I click an item the purchase prompt shows up with the correct item, but when I confirm purchase I seem to get a random item from the store.
local Market = game:GetService("MarketplaceService")
local ServerStorage = game:GetService("ServerStorage")
local players = game:GetService("Players")
local id = 1194047963
local function processReceipt2k(receiptInfo)
local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
print(player.Name)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if player then
player.leaderstats.Cash.Value += 2500
print("player received 2500 Cash")
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Market.ProcessReceipt = processReceipt2k
This is the server script that gives the player cash when the purchase is processed.
local Market = game:GetService("MarketplaceService")
local ServerStorage = game:GetService("ServerStorage")
local players = game:GetService("Players")
local id = 1194049240
local function processReceipt10k(receiptInfo)
local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
print(player.Name)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if player then
player.leaderstats.Cash.Value += 10000
print("player received 10000 Cash")
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Market.ProcessReceipt = processReceipt10k
Here is another server script that processes a different item in the store. There is almost nothing different about these scripts, why does it keep giving me a random item?
Edit: it's also worth noting that once I purchase the first time, if I click confirm purchase again, that first random item will be given every time.
Example: Player joined
*buys 10,000*
Console prints: Player bought 2500
*buys 10,000*
Console prints: Player bought 2500
*buys 10,000*
Console prints: Player bought 2500

1 comment
have you put all the items where they belong in the script?