How can I check my product is purchased?

I wanna give money If player purchased a product with robux
How can I check my product is purchased?

five.MouseButton1Click:Connect(function()
	local ItemID = 1625492885 

		local MarketplaceService = game.MarketplaceService
		MarketplaceService:PromptPurchase(game.Players.LocalPlayer, ItemID)
end)

1 Like

Search the docs first.

1 Like

Use MarketplaceSerivce.ProcessReceipt for Developer Products. This can only be done in a server script.


1 Like

This non-local script in ServerScriptService checking to see if they have a gamepass …
If so on each spawn they get a “SportsDrink” … Im sure you can figure it out from here.

local Players = game:GetService("Players")
local MarketPlaceService = game:GetService("MarketplaceService")
local gamepassID = 123456789 -- BlueGmePass -- SportsDrink

function Spawned(player)
	task.wait(1.1) local HasGamepass = false
	local success, message = pcall(function()
		HasGamepass = MarketPlaceService:UserOwnsGamePassAsync(player.userId, gamepassID)
	end)
	
	if not success then
		warn("Checking Gamepass "..tostring(message))
		return
	end
	
	if HasGamepass == true then
		game.ServerStorage.Tools.SpeedDrink2:Clone().Parent = player.Backpack
	end
end

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function()
		Spawned(player)
	end)
end)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.