Kill all DevProduct isn't working

--//Services
local MarketplaceService = game:GetService("MarketplaceService")
local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")

--//Tables
local productFunctions = {}

productFunctions[1255384268] = function(receipt, player)
	for i, Player in ipairs(Players:GetPlayers()) do
		if Player.Character then
			local Humanoid = Player.Character:FindFirstChildWhichIsA("Humanoid")
			
			if Humanoid then
				Humanoid.Health = 0
			end
		end
	end
end

--//Functions
local function processReceipt(receiptInfo)
	local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
	
	if not player then
		return nil
	end

	local handler = productFunctions[receiptInfo.ProductId]

	local success, result = pcall(handler, receiptInfo, player)
	
	if not success or not result then
		error("Failed to process a product purchase for ProductId:", receiptInfo.ProductId, " Player:", player)
		
		return nil
	end

	return true
end

MarketplaceService.ProcessReceipt = processReceipt

Just tried this script, no difference and no errors/print messages in the console.

What’s the script you use to prompt the purchase?

The local script being used for the button works

local MarketplaceService = game:GetService("MarketplaceService")

local Players = game:GetService("Players")

local productID = 1255384268

script.Parent.MouseButton1Click:Connect(function(promptPurchase)

local player = Players.LocalPlayer

MarketplaceService:PromptProductPurchase(player, productID)

end)

v.Character doesn’t reference LocalPlayer, v is the value that’s found by the for loop.

this may work. Kill all GUI Tutorial - Roblox

Are you processing any other devproducts from a different script? Ik that that can be an issue

Yes, I have dev products for cash buttons.

Only one script can process dev products. move all of them into a single script and try again

5 Likes

Thank you, it now works! :smiley:

30char