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

Intvalue value being added more than expected?

Haha, hey again! I am making a skip stage script but as always, a problem. Let me explain. So basically, I have a developer product that has a process request that detects if it has been completed! The problem is.. It adds to the last value that was added to the intvalue and then adds it to the intvalue all together! Let me show you a example. Lets say you have 1 + 1 right? Its obviously 2. But the conflict is that if you were to add again (not most likely but its my problem right now so lets just visualize) it would basically add 1 to 2 because 1 + 1 is 2 and then they see the value is 2 so they add 1 on it. so its like add then add value then times it here's why I want this problem fixed.

Its very cheap like 7 robux and people would want to buy it again in the same game for them it ends up skipping many many stages.

I dont really like people skipping stages that much and it can even break the game.

Anyways after that here's the code

game.Players.PlayerAdded:Connect(function(player)
	local value = Instance.new("IntValue",player)
	value.Name = "Stage" --the value
end)
debounce = false --i thought debounce would fix it :|
game.MarketplaceService.ProcessReceipt = function(receiptinfo)
	debounce = true
	if receiptinfo.ProductId == 1109289440 then
		local player = game.Players:GetPlayerByUserId(receiptinfo.PlayerId)
		player:WaitForChild("PlayerGui").Shop.TextButton.ScrollingFrame.TextButton.Text = "Please wait 2 seconds to buy again!"
		player.Stage.Value = player.Stage.Value + 1 --this?
		wait(2)
		debounce = false
	end
end

Let me specify

Not a local script its a script

In serverscriptservice

gamepass is a dev product

local script in startergui that makes the dev product pop up

and thats about it! So it adds it twice as you see here But if you help then thanks! If you dont that's okay.

1 answer

✓ Accepted answer

I'm pretty sure you need to add in Enum.ProductPurchaseDecision.PurchaseGranted to let Roblox know if a purchase is successfully made. Learn more about MarketplaceService.ProcessReceipt here.

Hope this helps.

4 comments

0

Yeah i noticed that i didn't add it right now yet but if i do that will it stop making it add more than expected?

0

Yes, i believe so. This is the same problem i had last time for not adding it.

0

Yep it works now better mark this as a solution i owe you alot thanks!

0

Always happy to help!

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