In my game I have a GUI instead of using the paid access in the games access settings, because it makes access cheaper...
I've got 2 buttons, 1 for tix and 1 for robux, and Im trying to make it so when they buy one of the two Dev Products the GUI gets removed and they can see. (The GUI takes up all of the screen)
INFO: My GUI is like this: ScreenGui(named Entry) in starter GUI. And inside this I have my 2 buttons named Purchase with a local script in... The transactions work, I've tested it on an alt, its just the GUI dosent get removed... Heres my script:
local developerProduct = 22199999 -- Product id game:GetService("MarketplaceService").ProcessReceipt = function(receipt) if receipt.ProductId == developerProduct then for i,v in pairs(game.Players:GetPlayers()) do if v.userId == receipt.PlayerId then v.game.StarterGui.Entry.Background.Visible = false end end end end
Ps: I know Dev Products are a one time thing.... I also got some of this code from other questions, I've just modified it a little to suit what I need it for.
I have 2 of these scrips, one for each button, and they're both in ServerScriptService
Your problem is that you're attempting to index the Gui by;
v.game.StarterGui.Entry
if v is the player, does it make much sense that the game would be inside the player? When a player joins, everytime their character loads the guis from StarterGui get Cloned into their PlayerGui. You can access your entry gui in the player's PlayerGui;
v.PlayerGui.Entry
Also, make sure you're returning that the purchase has been granted. You can do this by returning 'Enum.ProductPurchaseDecision.PurchaseGranted'. If you neglect to do this you will not earn any money from the developer product.
So, to fix your script;
local developerProduct = 22199999 game:GetService("MarketplaceService").ProcessReceipt = function(receipt) if receipt.ProductId == developerProduct then for i,v in pairs(game.Players:GetPlayers()) do if v.userId == receipt.PlayerId then v.PlayerGui.Entry.Background.Visible = false end end end return Enum.ProductPurchaseDecision.PurchaseGranted end