I don't see any errors it but doesn't work. There is the script:
function Click()
local players = game.Players.LocalPlayer
local id = 327347843
local p = game:GetService("MarketplaceService"):PromptProductPurchase(players, id)
if money == players:FindFirstChild("leaderstats"):WaitForChild("Money") then
if money == p then
money.Value = money.Value + 2
end
end
script.Parent.MouseButton1Click:Connect(Click)

3 comments
i belive it cant be in a local script
it is a localscript
Can you describe what actually doesn't work in your code so we can help? You can use prints and/or breakpoints to see what is wrong.