I made a developer product code. The GUI screen works good but not the buying system. The Roblox buying screen did show up but not my leaderboard stats> Here's the code
Marketplaceservice.ProcessReceipt = function(receiptinfo) for i, Player in ipairs(game:GetChildren()) do if Player.UserId == receiptinfo.PlayerId then if receiptinfo.ProductId == devid then Player.leaderstats.Coins.Value = Player.leaderstats.Coins.Value + 1000 end end end end
In the output, it said UserId is not a valid member of Workspace also it's clearly seen here that UserId is a member of Player, as shown on Roblox Dev Page: https://developer.roblox.com/api-reference/property/Player/UserId Can anyone fix this? Thanks! P/S: I have FE enabled
This one works for me, let's see if it works for you.
local Marketplaceservice = game:GetService('MarketplaceService') local devid = 85192395 Marketplaceservice.ProcessReceipt = function(receiptInfo) for i, player in ipairs(game.Players:GetChildren()) do if player.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == devid then player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1000 end end return Enum.ProductPurchaseDecision.PurchaseGranted end end