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.
