So this super weird problem I have with this is that there is no errors at all and it doesn't give the player the money basically scamming them. Can anyone help me fix this, it works perfectly in studio.

local mps = game:GetService("MarketplaceService") 
local ten = 457728758
local twentyfive = 457733655
local fifty = 457733930
local hundred = 457735038
local twofifty = 457739950
local thousand = 457740093
function mps.ProcessReceipt(receiptInfo)
	local player = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId)
	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	if receiptInfo.ProductId == ten then
		local stats = player.leaderstats.IslandBux
		stats.Value = stats.Value + 10
	end
	if receiptInfo.ProductId == twentyfive then
		local stats = player.leaderstats.IslandBux
		stats.Value = stats.Value + 25
	end
	if receiptInfo.ProductId == fifty then
		local stats = player.leaderstats.IslandBux
		stats.Value = stats.Value + 50
	end
	if receiptInfo.ProductId == hundred then
		local stats = player.leaderstats.IslandBux
		stats.Value = stats.Value + 100
	end
	if receiptInfo.ProductId == twofifty then
		local stats = player.leaderstats.IslandBux
		stats.Value = stats.Value + 250
	end
	if receiptInfo.ProductId == thousand then
		local stats = player.leaderstats.IslandBux
		stats.Value = stats.Value + 1000
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted	
end
--mps.ProcessReceipt = mps.ProcessReceipt

4 comments

0

Are you doing this from a LocalScript? You can't change leaderboard stats from the client.

0

No it's in the ServerScriptService.

0

You can charge players from the server side? Please give all of the relevant code.

0

It's being charged from the clients GUI.