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

Dev Product award giver is not working properly?

This is supposed to be giving 25 Gems but it is somehow giving sometimes even 500 gems?? What could the problem be?

This is in the serverscriptservice

stat = "Gems" 
award = 25 
------------------------------------------------------------------------------------------
MarketplaceService = Game:GetService("MarketplaceService")
MarketplaceService.ProcessReceipt = function(receiptInfo)
players = game.Players:GetPlayers()
for i=1,#players do
if players[i].userId == receiptInfo.PlayerId then
players[i].ds[stat].Value = players[i].ds[stat].Value+award
end

wait(1)
end
return Enum.ProductPurchaseDecision.PurchaseGranted	
end

This is in the Gui button

local productId = 25264216 -- Change to the ID of your developer product.
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
	game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)

1 answer

Just something, I'll turn the for loop into a generic for loop and see if that fixes anything, feel free to comment if something doesn't go right.


#Product

stat = "Gems" 
award = 25 
-----------------------------------------------------------------------------
MarketplaceService = Game:GetService("MarketplaceService")
MarketplaceService.ProcessReceipt = function(receiptInfo)
	for _,plyr in pairs(game:GetService("Players"):GetPlayers()) do
		if plyr.userId == receiptInfo.PlayerId then
			plyr.ds[stat].Value = plyr.ds[stat].Value+award
		end
	end
return Enum.ProductPurchaseDecision.PurchaseGranted 
end

Hope it helps!(Comment if there are any errors)

1 comment

0

Still gave me 500 :(

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