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

[SOLVED] How do I keep developer products from repeating on entry?

Edit: I forgot to tell the server that the purchase had been processed. I created a developer product that allows you to purchase more credits, but then, if you leave and rejoin, you get the same amount of credits again. Does anyone know how to fix this?

Here is the script:

local mps=game:GetService("MarketplaceService")
function getPlayerFromID(id)
	local plrs=game.Players:GetPlayers()
	for i=1,#plrs do
		if plrs[i].userId==id then
			return plrs[i]
		end
	end
end
mps.ProcessReceipt=function(info)
	if info.ProductId==22821479 then
		local plr=getPlayerFromID(info.PlayerId)
		plr.leaderstats.Cash.Value=plr.leaderstats.Cash.Value+1000
	elseif info.ProductId==22821510 then
		local plr=getPlayerFromID(info.PlayerId)
		plr.leaderstats.Cash.Value=plr.leaderstats.Cash.Value+2500
	elseif info.ProductId==22821535 then
		local plr=getPlayerFromID(info.PlayerId)
		plr.leaderstats.Cash.Value=plr.leaderstats.Cash.Value+5000
	elseif info.ProductId==22821547 then
		local plr=getPlayerFromID(info.PlayerId)
		plr.leaderstats.Cash.Value=plr.leaderstats.Cash.Value+10000
	end
end

If you can help me, that'd be great!

1 answer

✓ Accepted answer

You probably have a DataStore script somewhere in your game place which saves purchases. If you can find it, please post it, and I can help you further.

2 comments

0

The closest thing to that is the script that saves your total cash. I don't have a purchase save script.

0

That's what I meant. Please upvote. I could really use the rep. :D

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