Hi! I am trying to make a developer product for my Tycoon. For example I want the product to give $500 cash when a player buys it for $50 robux. I did the scripting and it does not work I will list them
ServerScriptService:
local MarketplaceService = game:GetService('MarketplaceService') local devproductid = 46984208 -- 500 cash 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 cash player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 500 end end end return Enum.ProductPurchaseDEcision.PurchaseGranted end
Workspace:
game.Players.PlayerAdded:connect(function(plr) local stats = Instance.new('BoolValue', plr) stats.Name = 'leaderstats' local cash = Instance.new('IntValue', stats) cash.Name = 'Cash' cash.Value = 0 end) Gui (local script): local button = script.Parent local devproductid = 46984208 button.MouseButton1Click:connect(function() game:getSerivce('MarketplaceService'):PromotProductPurchase(game.Players.LocalPlayer, devproductid) end)
If anyone knows why it wont work please help! All appreciated :)
Have you got a Leaderboard? Make a developer product: 1 . Go to Your game 2 . Press the 3 dots. 3. Press configure game. 4. Press developer products 5. Design your product. Instead of making your own script, why not try this: https://www.roblox.com/library/338900862/Zeds-Dev-Product-Kit