My Prompt developer product purchase script isn't working

Hello my script (which is a local script) is suppose to prompt a developer product purchase when you click the button but it doesn’t work can anyone help me here is my script.

local plr = game.Players.LocalPlayer

local button = script.Parent

local MarketPlaceService = game:GetService(“MarketplaceService”)

script.Parent.MouseButton1Click:Connect(function()

MarketPlaceService:PromptProductPurchase(plr, 980125722)

end)

I copied and pasted the script into roblox studio, and there was a red line in the parentheses

local MarketPlaceService = game:GetService(“ --[[HERE]]-- MarketplaceService”)

I changed it to this:

local MarketPlaceService = game:GetService("MarketplaceService")

as you can see very closely, the " marks are different on your version than they are on mine. Mine is straight while yours is curved(idk how you got that).

Just replace that line of code with the code I just put

Have a good day!

In the output box it says Player should be type of player but is of nil can you fix that?

Alright, think I fixed it:

local MarketPlaceService = game:GetService("MarketplaceService")

script.Parent.MouseButton1Click:Connect(function(plr)
	MarketPlaceService:PromptProductPurchase(plr,980125722)
end)

Have a good day!

MouseButton1Click doesn’t pass the player as an argument. The original code was correct. @ilovedevex Please debug your own code rather than asking for others to fix your code for you.

local MarketplaceService = game:GetService("MarketplaceService")
local LocalPlayer = game:GetService("Players").LocalPlayer

script.Parent.MouseButton1Click:Connect(function ()
    MarketplaceService:PromptProductPurchase(LocalPlayer, 980125722)
end)
1 Like