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

Why wont my Developers product give the player the money they bought?

Asked by 4 years ago

So, I've been working on this thing. and for some reason, when I buy it, it doesnt give the player the currency they are owed? Help pls ;-;

Script 1(localscript in button)

local MarketPlace = game:GetService("MarketplaceService")
local players = game:GetService("Players")

local ProductId = 1082680116
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
    wait(1)
    MarketPlace:PromptProductPurchase(player, ProductId)
end)

Script 2(script in serverscriptservice)

local MarketPlace = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local ProductId = (TheProductID)

local function proccessReciept(receiptInfo)

    local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
    if not player then
        --Player probably left
        --if they come back, the callback with begin again
        return Enum.ProductPurchaseDecision.NotProcessedYet
    end
    if player then
        player:WaitForChild('leaderstats'):WaitForChild('RunSpeed').Value = player.leaderstats.RunSpeed.Value +80
        return Enum.ProductPurchaseDecision.PurchaseGranted
    end

end

Thers nothing in output either.

0
Does your processReceipt function run in the first place? Where did you assign it to the ProcessReceipt function callback in MarketplaceService? User#834 0 — 4y
0
it says "Attempt to index nil with 'PlayerId' "? Galaxybombboy 134 — 4y
0
And, i just added that (How did i forget it?? XD) Galaxybombboy 134 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

It works now, not sure what I did but it works

Ad

Answer this question