local id = script.Parent.ProductId.Value
local remote = game.ReplicatedStorage.ForwardVibez
local mps = game:GetService("MarketplaceService")
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
mps:PromptProductPurchase(game.Players.LocalPlayer,id)
end)
So I’m trying to make it so when you buy a certain product, it gives you currency.
But I am quite stuck on what to use, I don’t know how to wait until a purchase is finished.
The third parameter shouldn’t be the word “true” since the value that the function returns for the third parameter could be true or false.
Instead, you could change it to something else such as “didPlayerPurchase” and you could print its value in the function to see if they purchased the item, cancelled it, etc…
mps.PromptProductPurchaseFinished:Connect(function(userId, productId, didPlayerPurchase)
print(didPlayerPurchase) -- This will be true or false
end)