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

Why wont this developer product work?

So im trying to make it show a gui when you buy it. but its not showing the gui. it prints but it doesnt show the gui

--Local script
workspace.RequestScreen.SurfaceGui:WaitForChild("Button").MouseButton1Click:connect(function()
	game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, 32468783)
end)

game:GetService("ServerStorage"):WaitForChild("Request").OnClientEvent:connect(function()
	local SongPicker = game.ReplicatedStorage.Requesting:Clone()
	SongPicker.Parent = game.Players.LocalPlayer.PlayerGui
	local CloneExploitChecker = Instance.new("StringValue", SongPicker)
	CloneExploitChecker.Name = ("Check"..game.Players.LocalPlayer.Name)
end)
--Regular Script
local MarketplaceService = game:GetService("MarketplaceService")

MarketplaceService.ProcessReceipt = function(receiptInfo) 
	for i, player in ipairs(game.Players:GetChildren()) do
		if player.userId == receiptInfo.PlayerId then
			if receiptInfo.ProductId == 32468783 then
				print("works")
				game:GetService("ServerStorage"):WaitForChild("Request"):FireClient(player)
			end
		end
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted		
end

1 answer

You can only process receipts in a server script. However, the key is to take the player who bought your product and send it to a RemoteEvent when you have processed the payment, and handle that payment by making the script use the player instead of the LocalPlayer.

1 comment

0

oops smh sorry i thought i deleted that part from the local script. but it is in a server script, so whats the problem?

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