Skip Stage product problem

Whenever I buy the product, it takes me up a stage, then I buy it again, it takes me up two, then it doesnt even go in a pattern. The only thing I could think of is maybe the adding problem, but I’ve tried fixing it, and honestly don’t know what to do at this point.

Explanation for checkpoint script: I made a leaderboard that would go up a stage for every checkpoint you touch, then named it 1,2,3 etc… and took their CFrame and just made the player spawn there.

Product Script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local RE = ReplicatedStorage.RemoteEvents
local SSE = RE:FindFirstChild("SkipStage")

function IncreaseStage(player)
	local leaderstats = player:FindFirstChild("leaderstats")
	local stage = leaderstats:FindFirstChild("Stage")

	stage.Value += 1
end

SSE.OnServerEvent:Connect(function(player)
	local playerID = player.UserId

	local id = 1759455988
	MarketplaceService:PromptProductPurchase(player, 1759455988)
	MarketplaceService.PromptProductPurchaseFinished:Connect(function(playerID, id)

		IncreaseStage(player)
	end)
end)

You are connecting the function every time the RemoteEvent is fired, use Once instead of Connect for this
Unrelated but I’d advise using MarketplaceService.ProcessReceipt instead of PromptProductPurchaseFinished. Since I’m bad at explaining so read the docs for more info: MarketplaceService | Documentation - Roblox Creator Hub (if you still don’t understand you can still ask me)

2 Likes