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

Why isn't my PromptPurchaseFinished event firing when i purchase the product?

Asked by 4 years ago

Localscript:

--Variables--
local Button = workspace.Shop.Buy_fifty_Coins.Purchase_Button.SurfaceGui.Button
local id = 933602329 
local MP = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait(0.01)
--<--->--
Button.Activated:Connect(function()
    MP:PromptProductPurchase(player,id)
end)

server script:

local MP = game:GetService("MarketplaceService")
local DTS = game:GetService("DataStoreService")
local Savevalues = DTS:GetDataStore("SaveValues")
local Id = 933602329

MP.PromptPurchaseFinished:Connect(function(player, Id, isPurchased)
    local Credits = player:WaitForChild("Currency").Credits
    print("Runned")
    if isPurchased then
        print("working")
        Credits.Value = Credits.Value +50

local Fol = player:WaitForChild("Currency")

local tosave = {}

for i,v in pairs(Fol:GetChildren())do
tosave[#tosave + 1] = v.Value
end
pcall(function()
Savevalues:SetAsync(player.UserId,tosave)

        print(player.Name.." Bought fifty Credits!")
end)
    end
    end)

0
what is the script suppose to do? raid6n 2196 — 4y
0
what is the script suppose to do? raid6n 2196 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

PromptPurchaseFinished doesn't fire for developer products. I believe the thing you want to use for this is the ProcessReceipt.

1
Oh thanks it works now :) Unscriptablee 20 — 4y
Ad

Answer this question