Hello everyone! I am working on a game which involves coins and I want to make a way to purchase currency. Overall, things had been going pretty well so far, the developer products were being prompted, but all of that came to an end when I started scripting the player receiving their coins. They just don’t get them.
Product Prompts Script (Probably irrelevant)
Product Prompts Script:
local shopframe = script.Parent.Parent
local mps = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
local coinshopframe = script.Parent.Parent.Parent.CoinShop
local back = script.Parent.Parent.Parent.Back
coinshopframe.Visible = false
script.Parent.MouseButton1Click:Connect(function()
shopframe.Visible = false
coinshopframe.Visible = true
back.MouseButton1Click:Connect(function()
shopframe.Visible = false
coinshopframe.Visible = false
end)
end)
--DEVPRODUCTS
script.Parent.Parent.Parent.CoinShop["50"].MouseButton1Click:Connect(function()
mps:PromptProductPurchase(player, 1589020332)
end)
script.Parent.Parent.Parent.CoinShop["100"].MouseButton1Click:Connect(function()
mps:PromptProductPurchase(player, 1589021131)
end)
script.Parent.Parent.Parent.CoinShop["250"].MouseButton1Click:Connect(function()
mps:PromptProductPurchase(player, 1589021665)
end)
script.Parent.Parent.Parent.CoinShop["500"].MouseButton1Click:Connect(function()
mps:PromptProductPurchase(player, 1589022270)
end)
script.Parent.Parent.Parent.CoinShop["1000"].MouseButton1Click:Connect(function()
mps:PromptProductPurchase(player, 1589023012)
end)
script.Parent.Parent.Parent.CoinShop["5000"].MouseButton1Click:Connect(function()
mps:PromptProductPurchase(player, 1589023518)
end)
script.Parent.Parent.Parent.CoinShop["10000"].MouseButton1Click:Connect(function()
mps:PromptProductPurchase(player, 1589025778)
end)
Currency Purchase Handler Script
Currency Purchase Handler Script:
local mps = game:GetService("MarketplaceService")
mps.ProcessReceipt = function(receiptinfo)
if receiptinfo == 1589020332 then
local player = game.Players:GetPlayerByUserId(receiptinfo.PlayerId)
player.leaderstats.Coins.Value += 50
return Enum.ProductPurchaseDecision.PurchaseGranted
else
if receiptinfo == 1589021131 then
local player = game.Players:GetPlayerByUserId(receiptinfo.PlayerId)
player.leaderstats.Coins.Value += 100
return Enum.ProductPurchaseDecision.PurchaseGranted
else
if receiptinfo == 1589021665 then
local player = game.Players:GetPlayerByUserId(receiptinfo.PlayerId)
player.leaderstats.Coins.Value += 250
return Enum.ProductPurchaseDecision.PurchaseGranted
else
if receiptinfo == 1589022270 then
local player = game.Players:GetPlayerByUserId(receiptinfo.PlayerId)
player.leaderstats.Coins.Value += 500
return Enum.ProductPurchaseDecision.PurchaseGranted
else
if receiptinfo == 1589023012 then
local player = game.Players:GetPlayerByUserId(receiptinfo.PlayerId)
player.leaderstats.Coins.Value += 1000
return Enum.ProductPurchaseDecision.PurchaseGranted
else
if receiptinfo == 1589023518 then
local player = game.Players:GetPlayerByUserId(receiptinfo.PlayerId)
player.leaderstats.Coins.Value += 5000
return Enum.ProductPurchaseDecision.PurchaseGranted
else
if receiptinfo == 1589025778 then
local player game.Players:GetPlayerByUserId(receiptinfo.PlayerId)
player.leaderstats.Coins.Value += 10000
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
end
end
end
end
end
end
I don’t see any errors in output. I have tried in the real game and on studio. Thanks to anyone who can possibly help me!