I have a Skip Stage thing in my obby, and the way it works is that it picks up the player clicking a button on the client, fires a remote event to the server, and then prompts the product purchase.
However, it has this gamebreaking glitch where when you purchase it, it does it multiple times, and how many times it does it increases by 1 every time, and starts at 1.
local MarketplaceService = game:GetService("MarketplaceService")
local ProductID = 1062453456
local event = game.ReplicatedStorage.RemoteEventsandFunctions.RemoteEvents.PromptPurchasetoPlayer
event.OnServerEvent:Connect(function(player)
MarketplaceService:PromptProductPurchase(player, ProductID)
end)
MarketplaceService.ProcessReceipt = function(receiptInfo)
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
print("hmm")
if not player then
print("no")
return Enum.ProductPurchaseDecision.NotProcessedYet
end
print("phew")
if receiptInfo.ProductId == ProductID then
if player then
print('yee')
local dataStore2 = require(1936396537)
local playerStage = dataStore2("AdventureObbySaves", player)
print("ok")
playerStage:Increment(1, 1)
player:LoadCharacter()
print("yes")
end
end
end

Can anyone help me out?