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

Developer product dealing with cash not working?

Asked by 8 years ago

The code is inside of a textbutton in StarterGui that I've made It's for a tycoon made by berezaa's tycoon kit, so to edit your Cash leaderstat, you have to edit the NumberValue it creates for each player inside of ServerStorage -> MoneyStorage

This is my code For some reason, it's not working.

It prompts and handles the purchase fine, but I never receive the reward.

local plr = game.Players.LocalPlayer
local link = game:GetService("MarketplaceService")
deb = 0


script.Parent.MouseButton1Click:connect(function()
local marketId = 29926564
link:PromptProductPurchase(plr,marketId)
link.ProcessReceipt = function(receiptInfo)
if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then
if deb == 0 then
deb = 1
local cash = game.ServerStorage.MoneyStorage:WaitForChild(plr.Name)
cash.Value = cash.Value + 5000
wait(1)
deb = 0
end
end
end
end)
0
One tip, space out your code properly. It make's it easier to read. ISellCows 2 — 8y
0
sorry about that :p ParkwaysV2 5 — 8y

Answer this question