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

When i buy Coins in studio its does work. But its not working in game?

Asked by 3 years ago

I tried to make my version of tower of hell, and made so people can buy coins for robux. When i buy coins in studio just test if it works, it do work, it gives me coins. But it doesnt work in MY game ( not in studio ). It still stays at the same amount.

-- touch to buy

MPS = game:GetService("MarketplaceService")
id = 1153921276
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
    MPS:PromptProductPurchase(player, id)
end)

-- main script that gives coins

local MPS = game:GetService("MarketplaceService")

MPS.ProcessReceipt = function(receiptInfo)
    if receiptInfo.ProductId == 1153921254 then
        local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
        player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 200
        return Enum.ProductPurchaseDecision.PurchaseGranted

    elseif receiptInfo.ProductId == 1153921276 then 
        local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
        player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 500
        return Enum.ProductPurchaseDecision.PurchaseGranted

    elseif receiptInfo.ProductId == 1153921344 then 
        local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
        player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 2000
        return Enum.ProductPurchaseDecision.PurchaseGranted

    elseif receiptInfo.ProductId == 1153921386 then 
        local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
        player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 10000
        return Enum.ProductPurchaseDecision.PurchaseGranted
    end
end
0
u published the game? johnoscarbhv1 137 — 3y

Answer this question