Hello! I'm having trouble getting my Developer Product to grant the product, in this case 100000 Points. When I test it in Studio, I can click on my Surface Gui to bring my shop screen up, I click on the product, "Purchase 100000 Points", the screen pops up to confirm the purchase...but then the Points aren't added. I receive this error:
23:22:41.888 - userId is not a valid member of BoolValue
I'm not sure why my userId is not valid, I've seen the script laid out this way elsewhere.
Also, when I do a local server test, my Screen Gui won't appear at all when I click it, same for when I upload my game to Roblox itself and try. Any thoughts?
Here's my code below for the developer product:
local MarketplaceService = game:GetService('MarketplaceService')
local devproductid = 48677962 -- DevId to Grant 100000 Points
MarketplaceService.ProcessReceipt = function(receiptInfo)
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == devproductid then
-- give them the Points
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 100000
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
And then I have this code inside the Text Button, inside the Frame, inside my Screen Gui inside Starter Gui:
local button = script.Parent
local devproductid = 48677962 -- 100000 Points
button.MouseButton1Click:connect(function()
game:GetService('MarketplaceService'):PromptProductPurchase(game.Players.LocalPlayer, devproductid)
end)
Thank you!

3 comments
Can you give us the line your error was on? Try capitalizing the first letter of 'userId' when you're getting a player's UserId. Also, sorry for what RomDino said, what he's doing is actually against the rules, and he has been reported.
It's okay, thank you for that. :) The answer from Foreverpower below allowed me to successfully make my purchase when I test it in Studio Play, but strangely, when I test the Local Server, or upload the game to Roblox, the Screen Gui with the Shop won't open. I get an error: 00:47:53.146 - PointsShop is not a valid member of PlayerGui PointsShop is my ScreenGui, which again works fine in Studio Pl
--Studio Play. Line 2 of the ScreenGui that it dislikes is: player.PlayerGui.PointsShop.ShopFrame.Visible = true Any thoughts? :(