When I attempt to run the code for prompting a developer product purchase I end up getting this in the output:
07:57:29.741 - MarketplaceService:PromptProductPurchase() player should be of type Player, but is of type nil 07:57:29.743 - Stack Begin 07:57:29.744 - Script 'Workspace.Gifts.Display.SurfaceGui.Script1', Line 9 07:57:29.745 - Stack End
I have no idea how to fix this and I have tried several things. Here's the code I'm trying to use as well:
local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players") local productID = 965613937 local function promptPurchase() local player = Players.LocalPlayer MarketplaceService:PromptProductPurchase(player, productID) end script.Parent.Small.MouseButton1Click:Connect(promptPurchase)
EDIT: I just realize your script work, but it need some change:
local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players") local productID = 965613937 local function promptPurchase() local player = Players.LocalPlayer MarketplaceService:PromptProductPurchase(player, productID) end game.Workspace.Gifts.Display.SurfaceGui.Small.MouseButton1Click:Connect(promptPurchase)
Change the script to LocalScript and put it in StarterPlayerScripts.
I already made a script... Why not you just try this:
Button.MouseButton1Click:Connect(function(promptPurchase) local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players") local productID = 965836984 local player = Players.LocalPlayer MarketplaceService:PromptProductPurchase(player, productID) end)
It works fine for me, tell me if it works