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

Player Point help????

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

script.Parent.MouseButton1Click:connect(function() 
Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)

It wont work when trying to insert 2 playerpoints into the game after bought a dev product.

1 answer

Try this in a GUI Button:

local Market = Game:GetService("MarketplaceService")
local Player = script.Parent.Parent.Parent.Parent
local Assets = {19874388}

script.Parent.MouseButton1Down:connect(function()
	Market:PromptProductPurchase(Player, Assets[1])
end)

Market.PromptProductPurchaseFinished:connect(function(userId, assetId, Purchased)
	if userId == Player.userId then
		if Purchased == true then
			Player.leaderstats["Money"].Value = Player.leaderstats["Money"].Value + 2
			wait(5)
		else
			
		end
	end
end)

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