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

(ANSWERD)How do i make this DevProduct Give What They Paid For?

Asked by
iWasThisi -15
4 years ago
Edited 4 years ago

Ive Tried To make This Work But Im Unsure Whats Wrong.

Script for serverscriptservice

local MPS = game:GetService("MarketplaceService")


MPS.ProcessReceipt = function(receiptInfo)
    if receiptInfo.ProductId == 985697300 then
        local player = game.Players:GetPlayerByUserId(receiptInfo.Playerid)
        player.leaderstats.Life.Value = player.leaderstats.Life.Value * 2
        return Enum.ProductPurchaseDecision.PurchaseGranted
    end
end

Script For StarterGUI

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

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

Thanks For Your Help Whoever Answers me!

0
Im Trying To Make it multiply the users current stats (if he has 20 it should make it 40) iWasThisi -15 — 4y

1 answer

Log in to vote
0
Answered by
MemezyDev 172
4 years ago

The error that you had was you had Playerid instead of PlayerId. The correct code should be

local MPS = game:GetService("MarketplaceService")


MPS.ProcessReceipt = function(receiptInfo)
    if receiptInfo.ProductId == 985697300 then
        local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
        player.leaderstats.Life.Value = player.leaderstats.Life.Value * 2
        return Enum.ProductPurchaseDecision.PurchaseGranted
    end
end

I tested ingame and it multiplied a value in leaderstats. Let me know any errors!

0
Thank You, Your Perfect! iWasThisi -15 — 4y
0
ty MemezyDev 172 — 4y
Ad

Answer this question