game:GetService("MarketplaceService").ProcessReceipt = function(Purchase)
	local plr_Is, key = false, ("user:"..Purchase.PlayerId);
	local function Coin_Update(prd_Id, plr)
		local info = game:GetService("MarketplaceService"):GetProductInfo(
			prd_Id, Enum.InfoType.Product);
		local amt = info.PriceInRobux * 5;
		local c_v = Coins:GetAsync(key);
		c_v = c_v + amt;
		Coins:SetAsync(key, c_v);
		plr:FindFirstChild("leaderstats"
			):FindFirstChild("RUN coins").Value = c_v;
		ui:FireClient(plr, {act = "C_add", amt = amt});
		plr_Is = true;
	end
	for i,v in pairs(game.Players:GetChildren()) do
		if v.UserId == Purchase.PlayerId then
			Coin_Update(Purchase.ProductId, v);
		end
	end
	if plr_Is == true then
		local info = game:GetService("MarketplaceService"):GetProductInfo(
			Purchase.ProductId, Enum.InfoType.Product);
		local Purchase_Con = {
			Purchase_Date = GetDate(),
			Purchase_Time = os.time(),
			Purchase_Product_Id = Purchase.ProductId,
			Purchase_Id = Purchase.PurchaseId,
			Product_Cost = info.price,
			Amount_Spent = Purchase.CurrencySpent
		}
		local history = Purchase_History:GetAsync(key);
		table.insert(history, Purchase_Con);
		Purchase_History:SetAsync(key, history);
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted;
end

I have created the following process receipt function in my game, and I have tested it three times now. However every time I spend 20 robux on the product, My main account does not receive any robux. I returned Enum.ProductPurchaseDecision.PurchaseGranted, however my account that owns the game still does not receive any robux. Am I placing the return statement in the wrong place? or does the robux take a long time to load? I would appreciate any help. Thanks

1 comment

0

Start by making sure this is a scripting issue. https://www.roblox.com/My/Money.aspx#/#Summary_tab and check under Pending Sales.