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

Developer Product multi awarding?

the script will award but it won't award the correct amount after the first time you buy the same Developer Product. It's like if you buy it and it will award you 2 points, and you keep buying it it will look like this.. First - 2 Second - 4 Third - 6 Fourth - 8 And so on. it keeps going up like that. I don't know why it keeps happening. I believe it has to do with 'pointsToAward' But I don't see how it keeps doing this.

Edit: It should only be awarding 2 each time they buy it, not how it is above.


local function buyItem(button)
	button.MouseButton1Click:connect(function()
		local marketId = button["market"].Value
		local pointsToAward = button["points"].Value
		link:PromptProductPurchase(plr,marketId) 
		link.ProcessReceipt = function(receiptInfo)
			if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then
				stat.Value = stat.Value + pointsToAward
			end
		end
	end)
end

2 answers

I would use a MarketplaceService instead of this, I can provide you the script, once I fixed it and if you want it.

You never turned the stat.Value to 0 to restart it. You always kept adding 2 on and on.

2 comments

0

stat.Value is their leaderstats.. If I changed that to 0, they would be mad. What the script keeps doing is keep rewarding them over and over again, I would need a way to delete the receiptInfo after it gave them the Currency...

0

Then turn the info to a var then reset it each time.

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