so this is the code im using
local player script.Parent.MouseButton1Click:Connect(function() local MarketplaceService = game:GetService("MarketplaceService") local productID = 994379939 player = script.Parent.Parent.Parent.Parent.Parent print(player) MarketplaceService:PromptProductPurchase(player,productID) end)
when a player clicks on it and make a purchases i dont know how to see when a player makes the purchases the code i want it to run when a player buys it is this:
player.leaderstats.lives.Value = player.leaderstats.lives.Value + 10
Use the PromptProductPurchaseFinished
event.
local player script.Parent.MouseButton1Click:Connect(function() local MarketplaceService = game:GetService("MarketplaceService") local productID = 994379939 player = script.Parent.Parent.Parent.Parent.Parent print(player) MarketplaceService:PromptProductPurchase(player,productID) MarketplaceService.PromptProductPurchaseFinished:Connect(function(player, productID, isPurchased) -- isPurchased is a bool value which tells you whether or not the player purchased the product if isPurchased == true then -- if player purchased the product -- fire a RemoteEvent here to change the player's leaderstats value in a server script else print("Player did not purchase product") end end) end)