Hello and good evening developers,
I am currently working on a script that prompts the player with my developer product for a sword. When it is done, it is supposed to check if the purchase was a success and if so, give the player the sword. The player is prompted with the developer product purchase, but the function does not work to check. Nothing happens when I cancel and when I purchase. Any help is appreciated. Thanks!
--D00MED_S0ULL local plr = game.Players.LocalPlayer local Click = game.StarterGui.GUIClick local gamepassId = 1207843619 -- All you have to do is change this to the right gamepass local PromptCashPurchase = game.ReplicatedStorage.PromptCashPurhcase local MarketplaceService = game:GetService("MarketplaceService") local Sword = game.ReplicatedStorage.Tools.AzureSword script.Parent.MouseButton1Click:Connect(function() Click:Play() MarketplaceService:PromptProductPurchase(plr, gamepassId) MarketplaceService.PromptPurchaseFinished:Connect(function(player, assetId, success) if success then if assetId == gamepassId then local Clone = Sword:Clone() Clone.Parent = player:WaitForChild("Backpack") end end end) end)