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

this script will add cash even when the product was canceled?

Asked by 4 years ago
Edited 4 years ago
MPS = game:GetService("MarketplaceService")
id = 554176812 --dev product id
local player = game.Players.LocalPlayer

script.Parent.Text = "5K Cash"
script.Parent.MouseButton1Click:Connect(function()
 MPS:PromptProductPurchase(player, id)
  script.Parent.Text = "Purhasing"
  wait(5)
  script.Parent.Text = "5K Cash"
  script.RemoteEvent:FireServer(player)
  return Enum.ProductPurchaseDecision.PurchaseGranted
end)

can some one tell me how to revise my script so that it'll only give the cash when the purchase was successful? not when it was canceled.

i do have an add cash script

so i have to use this script to add the cash

script.Parent.RemoteEvent.OnServerEvent:Connect(function(abc,player)
  player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 5000
end)

i use a remote function.

Answer this question