ProcessReceipt working partially

Greetings, developers!

I’ve gone ahead and created a ProcessReceipt callback. It works when I use it for the first time, but after the first line of the ProductFunction on any use after the first, it breaks. I can elaborate for anyone if needed, but here’s the broken code:

ProductFunctions[000000] = function(receipt, player) -- Changed to 000000 by me.
	player.leaderstats.Points.Value += 10 -- This always works.
	player.PlayerGui.ShopUI.Enabled = false -- This works once, but when you buy the product again, it doesn't work.
	player.PlayerGui.ThankYou.Enabled = true -- This works once, but when you buy the product again, it doesn't work.
	game.Lighting.Blur.Enabled = true -- This works once, but when you buy the product again, it doesn't work.
	
	return true
end

There are multiple of these functions, but they all are the same, other than them giving different amounts of currency.

The actual ProcessReceipt script works all the time, it’s just the function above that needs some fixing.

Thanks! :smile:

Is there any error in the console if you buy the product again? (when it doesnt work anymore)

1 Like

Nope, I wish it had one- :sob:

It does award the currency, but doesn’t open the UI, nor enable the blur after the second purchase. I’ve had this problem before, but never was able to fix it. Should I try changing the ZIndex?

^^ Nvm, just tested changing the ZIndex, it did nothing.

I think the problem is, that you enable the ScreenGuis on the Server and Disable/Hide them on the Client. (On the server, the ScreenGui is still Enabled.

You would have to use a RemoveEvent to enable the ScreenGui

I never even thought of that, thank you so much!

2 Likes