So I have this developer product script and it won't work for some reason, anyone know why? It doesn't throw any errors...

wait(.1)
plr = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent
ms = game:GetService("MarketplaceService")

script.Parent.Text = "Buy $"..script.Parent.plusCash.Value
script.Parent.MouseButton1Click:connect(function()
	ms:PromptProductPurchase(plr, script.Parent.id.Value)
end)

ms.ProcessReceipt = function(ri)
	if ri.ProductId == script.Parent.id.Value then
		if plr.userId == ri.PlayerId then
			plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + script.Parent.plusCash.Value
		end
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

3 comments

0

Make sure it is NOT in a LocalScript

0

Nope, if it was a LocalScript, I'd use game.Players.LocalPlayer

0

Try specifying the ProcessReceipt before your MouseButton1Down event.. I can't see anything else that could potentially make this not work