This script is supposed to detect when a player bought a Developer Product in the game, and give them points for doing so.

However, the script is not working, and I have no idea why, as output gave me nothing.

Can someone please help me?

Here's the script:

DataStore = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")



game:GetService("MarketplaceService").ProcessReceipt = function(infoo)
	local playerDPkey = infoo.PlayerId..":"..infoo.PurchaseId
	if DataStore:GetAsync(playerDPkey) then
	else
		print(playerDPkey)
		for i,v in pairs(game.Players:GetChildren()) do
			if v.userId == infoo.PlayerId then
				
				if infoo.ProductId == 29787465 then
					local lds = v:FindFirstChild("leaderstats")
					if lds ~= nil then
						local cs = lds:FindFirstChild("Points")
						if cs ~= nil then
							cs.Value = cs.Value + 1000
						end
					end
				end
				
			end
		end
		DataStore:SetAsync(playerDPkey, true)
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end