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

i cant make it so it will give you 1k cash?

it will work when you press it, but it does not give you cash. can you make it so it will give you cash

local productId = 726721893
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function() 
script.Parent:FindFirstChild("SelectionPopSound"):Play()
game:GetService("MarketplaceService"):PromptPurchase(player, productId)
end)

4 comments

0

Could you show a bit more code?

0

thats all i have

0

my cash is in the player, and the cash is caled coins

0

Just posted a answer hope it helped

2 answers

✓ Accepted answer

Sorry for the short answer,

local coins = --PATH OF COINS

---when purchase 

coins = coins + 1000

So I have my own thing like this and it can do multiple.

---Script goes in ServerScriptService---

local MarketplaceService = game:GetService("MarketplaceService")

local Products = {
	[0]=function(receipt,player) ---Product Id
		player.leaderstats.Cash.Value = player.leaderstats.coin.Value +10
	end;
	[0]=function(receipt,player) ---Product Id
		player.leaderstats.Cash.Value = player.leaderstats.coin.Value +25
	end;
	[0]=function(receipt,player) ---Product Id
		player.leaderstats.Cash.Value = player.leaderstats.coin.Value +40
	end;
	[0]=function(receipt,player) ---Product Id
		player.leaderstats.Cash.Value = player.leaderstats.coin.Value +60
	end;
	[0]=function(receipt,player) ---Product Id
		player.leaderstats.Cash.Value = player.leaderstats.coin.Value +400
	end;
	[0]=function(receipt,player) ---Product Id
		player.leaderstats.Cash.Value = player.leaderstats.coin.Value +1000
	end;
	[0]=function(receipt,player) ---Product Id
		player.leaderstats.Cash.Value = player.leaderstats.coin.Value +10000
	end;
	[0]=function(receipt,player) ---Product Id
		player.leaderstats.Cash.Value = player.leaderstats.coin.Value +50000
	end;
}

function MarketplaceService.ProcessReceipt(receiptinfo)
	local playerProductKey = receiptinfo.PlayerId..":"..receiptinfo.PurchaseId
	local plr = game:GetService("Players"):GetPlayerByUserId(receiptinfo.PlayerId)
	
	local handler
	for ProductId,func in pairs(Products) do
		if ProductId == receiptinfo.ProductId then
			handler = func break
		end
	end
	
local suc = pcall(handler,receiptinfo,plr)
return Enum.ProductPurchaseDecision.PurchaseGranted
end

---Script for the Gui Button---

script.Parent.MouseButton1Click:Connect(function()
	game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer,0) --- the product ID
end)

1 comment

0

thanks

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