In the startpack I have a localscript with this:
local productId = 19186931 plr = game.Players.LocalPlayer plrgui = plr:WaitForChild("PlayerGui") plrgui.ChildAdded:connect(function(child) if child.Name == "EndGui" then wait() buyButton = script.Parent.Parent.PlayerGui.EndGui.Continue buyButton.MouseButton1Click:connect(function() if buyButton.Visible == true then Game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId) end end) end end)
This script seemingly works perfectly. It fires the transaction, so that's all good! It's the server side script in Workspace that seems to have problems.
This is the server script:
local MarketplaceService = Game:GetService("MarketplaceService") local productId = 19186931 local ds = game:GetService("DataStoreService"):GetDataStore("ContinueButton") function GetPlayerById(id) for _,v in ipairs(game.Players:GetPlayers())do if(v.userId==id)then return(v) end end return(nil) end MarketplaceService.ProcessReceipt = function(receiptInfo) if receiptInfo.ProductId == productId then local asynccode = receiptInfo.PlayerId .. "buys" if ds:GetAsync(asynccode) == nil then ds:SetAsync(asynccode, 0) end ds:IncrementAsync(asynccode, 1) print("Player bought the continue developer product. Player now has "..ds:GetAsync(asynccode).." buys.") currentplr = GetPlayerById(receiptInfo.PlayerId) gui = currentplr.PlayerGui gui.continuegame.Disabled = false return Enum.ProductPurchaseDecision.PurchaseGranted end end
I have tried using both ROBLOX remote error and Obox checking system but neither print any of the prints I have and neither display any errors.. But it doesn't work!
What's wrong? If you can offer a solution to the debugger that'd be even better!
(P.S. you could have edited the old question rather than make a new one)
Try changing line 17 in the Script to this:
if not (ds:GetAsync(asynccode) or false) then
If that doesn't work, try using a RemoteFunction to call the PromptProductPurchase from the Script instead of the LocalScript.