Hello there! I am trying to make a dev product. The prompt purchase works but when the player purchases it, no tokens are added .I suspect that the callback is not working or i got the callback wrong but i’ve tried fixing that it still didnt work. It printed 1 and 2 and “purchasing” but not “yea” . No error on output too
local script:
wait(1)
local button = script.Parent
local Id = button.ProductId.Value
local plyr = game.Players.LocalPlayer
local MarketPlaceService = game:GetService("MarketplaceService")
button.MouseButton1Click:Connect(function()
print("1")
MarketPlaceService:PromptProductPurchase(plyr, Id)
print("2")
end)
server:
local plyrs = game:GetService("Players")
local MarketPlaceService = game:GetService("MarketplaceService")
local function processReceipt(receiptInfo)
print("purchasing")
local plr = plyrs:GetPlayerByUserId(receiptInfo.PlayerId)
local productId = receiptInfo.ProductId
if not plr then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if plr then
if productId == "1232493039" then
local add = 500
elseif productId == "1232493120" then
local add = 1000
elseif productId == "1232493242" then
local add = 1500
elseif productId == "1232493507" then
local add = 4100
elseif productId == "1232493505" then
local add = 11000
local tokens = plr.PlayerValues.Tokens
tokens.Value = tokens.Value +add
print(add)
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
print('yea')
end
MarketPlaceService.ProcessReceipt = processReceipt