Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Problem with MarketplaceService?

So I have this problem with MarketplaceService that it won't give me 10000 cash when I buy it online. Heres the script:

local gui = script.Parent
local plr = gui.Parent.Parent.Parent

local market = game:GetService("MarketplaceService")


function add10000cash()
	if plr then
		local leaderstats = plr:FindFirstChild("leaderstats")
		if leaderstats then
			local cash = leaderstats:FindFirstChild("Cash")
			if cash then
				cash = cash + 10000
			end
		end
	end
end

script.Parent.MouseButton1Click:connect(function()
	market:PromptProductPurchase(plr, 22957008, false, Enum.CurrencyType.Robux)
	add10000cash()
end)

Can anyone tell me whats happening? Thanks!

1 answer

I'm assuming "Cash" is a value. On line 13 change

cash = cash + 10000

to

cash.Value = cash.Value + 10000

But the way you have it, it will give the player 10000 money even when they don't buy the pass. Please take a look at this: ProcessReceipt

This discussion is preserved as it was. New answers, comments, and votes are closed.