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

Confirm in game purchase?

Alright, So I'm trying to get this script to add points to a leaderboard but how do I confirm that they bought the item and how do I add to the leaderboard?

local Id = script.Parent.ID.Value 
local player = game.Players.LocalPlayer

function onClick() 
Game:GetService("MarketplaceService"):PromptPurchase(player, script.Parent.ID.Value, false, 0) 
end

script.Parent.MouseButton1Click:connect(onClick)

1 answer

You can use the PromptPurchasedFinished event.

Server script:

Game:GetService("MarketplaceService").PromptPurchaseFinished:connect(
function(Player,Id,Purchased)
	if Purchased then
		if Id == 3 then
			--Do stuff
			Player.Character:BreakJoints()
		elseif Id == 32 then
			--Stuff
		end
	end
end)

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