Here's my code, if you can, please fix and let me know how to avoid this problem.

local MarketplaceService = game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local gpid = 4905027
local repStore = game:GetService("ReplicatedStorage")
local remote = repStore:WaitForChild("BoughtGamePass")

MarketplaceService.PromptGamePassPurchaseFinished = function(receiptInfo)
	for i, player in ipairs(game.Players:GetChildren()) do
		if player.userId == receiptInfo.PlayerId then

			if receiptInfo.ProductId == gpid then
				player.leaderstats.Money.Value = player.leaderstats.Money.Value + 100		
			end
		end
	end	
	return Enum.ProductPurchaseDecision.PurchaseGranted 
end