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

Developer product + Data store script issues

Old post

I've posted it before, but made a new post as I have an editted script.

So now I have this script:

local MarketplaceService = Game:GetService("MarketplaceService")
local productId = 19186931
local ds = game:GetService("DataStoreService"):GetDataStore("ContinueButton")

function GetPlayerById(id)
	for _,v in ipairs(game.Players:GetPlayers())do
		if(v.userId==id)then
		return(v) 
		end
	end
	return(nil)
end

MarketplaceService.ProcessReceipt = function(receiptInfo)
	if receiptInfo.ProductId == productId then
	local asynccode = receiptInfo.PlayerId .. "buys"
		if ds:GetAsync(asynccode) == nil then
			ds:SetAsync(asynccode, 0) 
		end
	ds:IncrementAsync(asynccode, 1)
	print("Player bought the continue developer product. Player now has "..ds:GetAsync(asynccode).." buys.")
	
	currentplr = GetPlayerById(receiptInfo.PlayerId)
	
	gui = currentplr.PlayerGui
	gui.continuegame.Disabled = false
	
	return Enum.ProductPurchaseDecision.PurchaseGranted		
	end
	end

I do not know if there is any output, as I am unable to test it in play solo or start server mode. Can any of you keen debuggers spot any pesky bugs?

1 answer

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