I have this code From Roblox developer site but its not printing
local MarketplaceService = game:GetService("MarketplaceService")
MarketplaceService.PromptPurchaseFinished:Connect(function(player, assetId, isPurchased)
if isPurchased then
print(player.Name .. " bought an item with AssetID: " .. assetId)
else
print(player.Name .. " didn't buy an item with AssetID: " .. assetId)
end
end)
What are you prompting? Keep in mind that game passes, products and bundles have a dedicated prompt finished event that you need to connect to. PromptPurchaseFinished does not fire if you prompt a purchase for any of those three asset types.
Again, you need to provide more information otherwise we can’t help you. If you need a checklist of things that you should provide, here:
What type of script is this?
Where is the script?
What is the id of the item you’re attempting to prompt?
What is the type of item you’re attempting to prompt? Product? Game pass? Shirt? What is it?
How are you prompting the player? What code prompts the purchase to the player?
Are there any errors in your console? If so, what is the error telling you?
It is imperative that you supply details if you’re looking for help, otherwise we have limited information to go off of. We need to understand your exact circumstances.
I really don’t believe in re-inventing the wheel, as it takes too long and will never be as good as the original, so why no learn from the people who make the platform…
1- Its script
2- ServerScriptService
3- 19260946
4- Gamepass
5- A button and this local script =
script.Parent.MouseButton1Click:Connect(function(plr)
if not game.MarketplaceService:UserOwnsGamePassAsync(game.Players.LocalPlayer.UserId, 18662868) then
game.MarketplaceService:PromptGamePassPurchase(game.Players.LocalPlayer, 18662868)
end
end)
Right: I tried using the information you’ve supplied and it still prints for me regardless. I have a script in ServerScriptService connecting to PromptGamePassPurchaseFinished and a LocalScript that’s using the PromptGamePassPurchase code.
There is something fundamentally wrong in your circumstances. More information still needs to be supplied here. Try applying some debugging strategies like using prints around your code and seeing what does or doesn’t print and going off of there.